3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">// Implementation class for created the tree powered form field
\r
9 ListSelector = Ext.extend(Ext.ux.TreeSelector, {
\r
11 listenForLoad: false,
\r
12 initComponent : function(){
\r
14 this.tree = new Ext.tree.TreePanel({
\r
17 width: this.treeWidth || 180,
\r
20 selModel: new Ext.tree.ActivationModel(),
\r
21 loader : new ListLoader({store: this.store})
\r
24 var root = new Ext.tree.AsyncTreeNode({
\r
28 iconCls: 'icon-folder',
\r
32 this.tree.setRootNode(root);
\r
34 this.tree.on('render', function(){
\r
35 this.store.bindTree(this.tree);
\r
38 ListSelector.superclass.initComponent.call(this);
\r
40 // selecting folders is not allowed, so filter them
\r
41 this.tree.getSelectionModel().on('beforeselect', this.beforeSelection, this);
\r
43 // if being rendered before the store is loaded, reload when it is loaded
\r
44 if(this.listenForLoad) {
\r
45 this.store.on('load', function(){
\r
53 beforeSelection : function(tree, node){
\r
54 if(node && node.attributes.isFolder){
\r