Clear Up
SharpKit Reference

TreeStore Class

The TreeStore is a store implementation that is backed by by an It provides convenience methods for loading nodes, as well as the ability to use the hierarchical tree structure combined with a store. This class is generally used in conjunction with Ext.tree.Panel. This class also relays many events from the Tree for convenience.

Using Models

If no Model is specified, an implicit model will be created that implements The standard Tree fields will also be copied onto the Model for maintaining their state. These fields are listed in the documentation.

Reading Nested Data

For the tree to read nested data, the must be configured with a root property, so the reader can find nested data for each node (if a root is not specified, it will default to 'children'). This will tell the tree to look for any nested tree nodes by the same keyword, i.e., 'children'. If a root is specified in the config make sure that any nested nodes with children have the same name. Note that setting defaultRootProperty accomplishes the same thing.



Name Description
clearOnLoad Remove previously existing child nodes before loading. Defaults to: true
clearRemovedOnLoad If true, when a node is reloaded, any records in the removed record collection that were previously descendants of the node being reloaded will be cleared from the removed collection. Only applicable if clearOnLoad is true. Defaults to: true
defaultRootId The default root id. Defaults to: "root"
defaultRootProperty The root property to specify on the reader if one is not explicitly defined. Defaults to: "children"
folderSort Set to true to automatically prepend a leaf sorter. Defaults to: false
nodeParam The name of the parameter sent to the server which contains the identifier of the node. Defaults to: "node"
root The root node for this store. For example:
root: {
            expanded: true,
            text: "My Root",
            children: [
            { text: "Child 1", leaf: true },
            { text: "Child 2", expanded: true, children: [
            { text: "GrandChild", leaf: true }
            ] }
Setting the root config option is the same as calling setRootNode.


Name Description
getNodeById(object) Returns the record node by id
getRootNode() Returns the root node for this tree.
setRootNode(object) Sets the root node for this store. See also the root config option.
© Copyright 2005-2011 SharpKit. All rights reserved.