X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/docs/source/ListSelector.html diff --git a/docs/source/ListSelector.html b/docs/source/ListSelector.html new file mode 100644 index 00000000..bd111411 --- /dev/null +++ b/docs/source/ListSelector.html @@ -0,0 +1,61 @@ + +
+// Implementation class for created the tree powered form field +ListSelector = Ext.extend(Ext.ux.TreeSelector, { + maxHeight:200, + listenForLoad: false, + initComponent : function(){ + + this.tree = new Ext.tree.TreePanel({ + animate:false, + border:false, + width: this.treeWidth || 180, + autoScroll:true, + useArrows:true, + selModel: new Ext.tree.ActivationModel(), + loader : new ListLoader({store: this.store}) + }); + + var root = new Ext.tree.AsyncTreeNode({ + text: 'All Lists', + id: 'root', + leaf: false, + iconCls: 'icon-folder', + expanded: true, + isFolder: true + }); + this.tree.setRootNode(root); + + this.tree.on('render', function(){ + this.store.bindTree(this.tree); + }, this); + + ListSelector.superclass.initComponent.call(this); + + // selecting folders is not allowed, so filter them + this.tree.getSelectionModel().on('beforeselect', this.beforeSelection, this); + + // if being rendered before the store is loaded, reload when it is loaded + if(this.listenForLoad) { + this.store.on('load', function(){ + root.reload(); + }, this, { + single: true + }); + } + }, + + beforeSelection : function(tree, node){ + if(node && node.attributes.isFolder){ + node.toggle(); + return false; + } + } +});+ + \ No newline at end of file