dijit/tree/Model
This is an abstract interface that describes the methods and properties provided by a tree model.
The dijit/tree/ObjectStoreModel is an example of a pre-built instance of this interface.
An implementation of this interface must provide:
• destroy
• getChildren – Obtain a list of children of the passed in item.
• getIdentity – Return the identity of the passed in item.
• getLabel – Return the label that should be used for the item in the tree.
• getRoot(onItem) – Calls a function with the root items as a parameter. Note: This is
rather subtle. We would have expected this to return the root item but take care to note that
it is a function that needs to be called which is passed as a parameter.
• isItem
• mayHaveChildren – Determine if the passed in item may have children.
• newItem
• pasteItem
and publish the following events:
• onClick(item, node, event) – Called when an item in the tree is clicked.
• onChange
• onChildrenChange
A template for this object might be:
var model = {
destroy: function() {
},
getChildren: function(parentItem, onComplete) {
},
getIdentity: function(item) {
},
getLabel: function(item) {
},
getRoot: function(onItem) {
onItem(root); // Note
},
isItem: function(item) {
},
mayHaveChildren: function(item) {
},
newItem: function(item) {
},
pasteItem: function(childItem, oldParentItem, newParentItem, bCopy, insertIndex, before) {
},
onChange: function(item) {
},
onChildrenChange: function(parent, newChildrenList) {
}
};
dijit/tree/ObjectStoreModel
The dijit/tree/ObjectStoreModel is a provided implementation of the
Page 191
Comentarios a estos manuales