X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/source/TreeStore.html diff --git a/docs/source/TreeStore.html b/docs/source/TreeStore.html index 8e1f3150..1916f5f0 100644 --- a/docs/source/TreeStore.html +++ b/docs/source/TreeStore.html @@ -16,21 +16,20 @@
/** - * @class Ext.data.TreeStore - * @extends Ext.data.AbstractStore - * - * The TreeStore is a store implementation that is backed by by an {@link Ext.data.Tree}. + * The TreeStore is a store implementation that is backed by by an {@link Ext.data.Tree}. * 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 {@link Ext.tree.Panel}. This class also relays many events from * the Tree for convenience. * - * ## Using Models + * # Using Models + * * If no Model is specified, an implicit model will be created that implements {@link Ext.data.NodeInterface}. * The standard Tree fields will also be copied onto the Model for maintaining their state. * - * ## Reading Nested Data - * For the tree to read nested data, the {@link Ext.data.Reader} must be configured with a root property, + * # Reading Nested Data + * + * For the tree to read nested data, the {@link Ext.data.reader.Reader} 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'. */ @@ -39,15 +38,34 @@ Ext.define('Ext.data.TreeStore', { alias: 'store.tree', requires: ['Ext.data.Tree', 'Ext.data.NodeInterface', 'Ext.data.NodeStore'], + /** + * @cfg {Ext.data.Model/Ext.data.NodeInterface/Object} 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 {@link #setRootNode}. + */ + /** - * @cfg {Boolean} clearOnLoad (optional) Default to true. Remove previously existing - * child nodes before loading. + * @cfg {Boolean} clearOnLoad + * Remove previously existing child nodes before loading. Default to true. */ clearOnLoad : true, /** - * @cfg {String} nodeParam The name of the parameter sent to the server which contains - * the identifier of the node. Defaults to <tt>'node'</tt>. + * @cfg {String} nodeParam + * The name of the parameter sent to the server which contains the identifier of the node. + * Defaults to 'node'. */ nodeParam: 'node', @@ -64,7 +82,8 @@ Ext.define('Ext.data.TreeStore', { defaultRootProperty: 'children', /** - * @cfg {Boolean} folderSort Set to true to automatically prepend a leaf sorter (defaults to <tt>undefined</tt>) + * @cfg {Boolean} folderSort + * Set to true to automatically prepend a leaf sorter. Defaults to `undefined`. */ folderSort: false, @@ -72,7 +91,6 @@ Ext.define('Ext.data.TreeStore', { var me = this, root, fields; - config = Ext.apply({}, config); @@ -89,23 +107,6 @@ Ext.define('Ext.data.TreeStore', { // We create our data tree. me.tree = Ext.create('Ext.data.Tree'); - - me.tree.on({ - scope: me, - remove: me.onNodeRemove, - beforeexpand: me.onBeforeNodeExpand, - beforecollapse: me.onBeforeNodeCollapse, - append: me.onNodeAdded, - insert: me.onNodeAdded - }); - - me.onBeforeSort(); - - root = me.root; - if (root) { - delete me.root; - me.setRootNode(root); - } me.relayEvents(me.tree, [ /** @@ -229,6 +230,25 @@ Ext.define('Ext.data.TreeStore', { */ "rootchange" ]); + + me.tree.on({ + scope: me, + remove: me.onNodeRemove, + // this event must follow the relay to beforeitemexpand to allow users to + // cancel the expand: + beforeexpand: me.onBeforeNodeExpand, + beforecollapse: me.onBeforeNodeCollapse, + append: me.onNodeAdded, + insert: me.onNodeAdded + }); + + me.onBeforeSort(); + + root = me.root; + if (root) { + delete me.root; + me.setRootNode(root); + } me.addEvents( /** @@ -359,8 +379,8 @@ Ext.define('Ext.data.TreeStore', { }, /** - * Sets the root node for this store - * @param {Ext.data.Model/Ext.data.NodeInterface} root + * Sets the root node for this store. See also the {@link #root} config option. + * @param {Ext.data.Model/Ext.data.NodeInterface/Object} root * @return {Ext.data.NodeInterface} The new root */ setRootNode: function(root) { @@ -496,7 +516,7 @@ Ext.define('Ext.data.TreeStore', { }, /** - * Create any new records when a write is returned from the server. + * Creates any new records when a write is returned from the server. * @private * @param {Array} records The array of new records * @param {Ext.data.Operation} operation The operation that just completed @@ -535,7 +555,7 @@ Ext.define('Ext.data.TreeStore', { }, /** - * Update any records when a write is returned from the server. + * Updates any records when a write is returned from the server. * @private * @param {Array} records The array of updated records * @param {Ext.data.Operation} operation The operation that just completed @@ -566,7 +586,7 @@ Ext.define('Ext.data.TreeStore', { }, /** - * Remove any records when a write is returned from the server. + * Removes any records when a write is returned from the server. * @private * @param {Array} records The array of removed records * @param {Ext.data.Operation} operation The operation that just completed