Ext2.2 Tree加载本地数据
Ext2.x的Tree不支持加载本地数据,项目需要自己重写源码.
TreeLoader源码的load方法添加:
load : function(node, callback){ if(this.localData){ this.handleLocalData(node,callback); return; } ....
//handle local data handleLocalData:function(node, callback){ if(this.doPreload(node)){ if(typeof callback == "function"){ callback(); } return; } if (this.clearOnLoad) {while (node.firstChild) {node.removeChild(node.firstChild);}} this.transId = false; //copy a data from source try { var o = this.localData; node.beginUpdate(); for(var i = 0, len = o.length; i < len; i++){ var n = this.createNode(o[i]); if(n){ node.appendChild(n); } } node.endUpdate(); if(typeof callback == "function"){ callback(this, node); } }catch(e){ } this.fireEvent("load", this, node, this.localData); }