X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/docs/source/ListLoader.html?ds=inline diff --git a/docs/source/ListLoader.html b/docs/source/ListLoader.html new file mode 100644 index 00000000..3f73c335 --- /dev/null +++ b/docs/source/ListLoader.html @@ -0,0 +1,61 @@ + +
+ListLoader = function(config){ + Ext.apply(this, config); +}; + +Ext.extend(ListLoader, Ext.util.Observable, { + keyAttribute: 'id', + keyField: 'parentId', + + load: function(node, callback){ + var key = this.keyField; + var v = node.attributes[this.keyAttribute]; + var rs = this.store.queryBy(function(r){ + return r.data[key] === v; + }); + node.beginUpdate(); + for (var i = 0, d = rs.items, len = d.length; i < len; i++) { + var n = this.createNode(d[i]); + if (n) { + node.appendChild(n); + } + } + node.endUpdate(); + if(typeof callback == "function"){ + callback(this, node); + } + }, + + createNode : function(record){ + var d = record.data, n; + if(d.isFolder){ + n = new Ext.tree.AsyncTreeNode({ + loader: this, + id: record.id, + text: d.listName, + leaf: false, + iconCls: 'icon-folder', + editable: true, + expanded: true, + isFolder: true + }); + }else{ + n = new Ext.tree.TreeNode({ + id: record.id, + text: d.listName, + leaf: true, + iconCls: 'icon-list', + editable: true + }); + } + return n; + } +});+ + \ No newline at end of file