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">ListLoader = function(config){
\r
9 Ext.apply(this, config);
\r
12 Ext.extend(ListLoader, Ext.util.Observable, {
\r
14 keyField: 'parentId',
\r
16 load: function(node, callback){
\r
17 var key = this.keyField;
\r
18 var v = node.attributes[this.keyAttribute];
\r
19 var rs = this.store.queryBy(function(r){
\r
20 return r.data[key] === v;
\r
23 for (var i = 0, d = rs.items, len = d.length; i < len; i++) {
\r
24 var n = this.createNode(d[i]);
\r
26 node.appendChild(n);
\r
30 if(typeof callback == "function"){
\r
31 callback(this, node);
\r
35 createNode : function(record){
\r
36 var d = record.data, n;
\r
38 n = new Ext.tree.AsyncTreeNode({
\r
43 iconCls: 'icon-folder',
\r
49 n = new Ext.tree.TreeNode({
\r
53 iconCls: 'icon-list',
\r