Constructordijit.tree.ForestStoreModel

dojo.require("dijit.Tree");
defined in dijit/Tree.js

Use this class to wrap a dojo.store, making all the items matching the specified query appear as children of a fabricated "root item". If no query is specified then all the items returned by fetch() on the underlying store become children of the root item. It allows dijit.Tree to assume a single root item, even if the store doesn't have one.

Usage

function (params) (view source)
parametertypedescription
params  

Examples

Example 1

{type:'continent'}

Jump to PropertiesFunctionsBack to top

FunctiongetChildren(parentItem, callback, onError: Function)
Calls onComplete() with array of child items of given parent item, all loaded.
FunctiongetLabel(item)
get the label for an item
FunctiongetRoot(onItem, onError)
Calls onItem with the root item for the tree, possibly a fabricated item. Calls onError on error.
Tells if an item has or may have children. Implementing logic here avoids showing +/- expando icon for nodes that we know don't have children. (For efficiency reasons we may not want to check if an element actually has children until user clicks the expando node)
FunctionnewItem(args: Object?, parent)
Creates a new item. See dojo.data.api.Write for details on args. Used in drag & drop when item from external source dropped onto tree.
Called when item added to root of tree; user must override to modify the item so that it matches the query for top level items
FunctiononChange(item)
Callback whenever an item has changed, so that Tree can update the label, icon, etc. Note that changes to an item's children or parent(s) will trigger an onChildrenChange() so you can ignore those changes here.
FunctiononChildrenChange(parent, newChildrenList)
Callback to do notifications about new, updated, or deleted items.
Called when item removed from root of tree; user must override to modify the item so it doesn't match the query for top level items
User can override this method to modify a new element that's being added to the root of the tree, for example to add a flag like root=true
FunctionpasteItem(childItem, oldParentItem, newParentItem, bCopy: Boolean)
Move or copy an item from one parent item to another. Used in drag & drop
handler for delete notifications from underlying store
Function_onNewItem(item, parentInfo: Object)
handler for when new items appear in the store.
Function_onSetItem(item, attribute, oldValue: Object|Array, newValue: Object|Array)
set data event on an item in the store

Jump to FunctionsPropertiesBack to top

one ore more attributes that holds children of a tree node
Specifies the set of children of the root item.
Pointer to the root item (read only, not a parameter)
Label of fabricated root item