var westObj = new Ext.tree.TreePanel({ region : 'west', id : 'aphyciniTree', collapsible : true, animate : true, enableDD : true, title : '<div>aphycini note</div>', width : 300, autoScroll : true, split : true, // loader : treeLoader, loader : new Ext.tree.TreeLoader({ dataUrl : basePath + 'web/aphycini/getAphyciniTree', baseParams : { condition : '' } }), root : new Ext.tree.AsyncTreeNode({// 树根 id : '-1', text : 'aphycini note', iconCls : 'treeNodeStyle', expanded : true, leaf : false }), rootVisible : true,// 根节点的可见性 listeners : { click : function(node) { alert(node.attributes.id) } }, tbar : [ '->', new Ext.form.TextField({ id : 'queryConditon', emptyText : '请输入查询条件', width : 200 }), '-', { text : '搜索', iconCls : 'queryStyle', handler : function() { var condition = $.trim(Ext.getCmp('queryConditon') .getValue()); // alert(condition) var aphyciniTree = Ext.getCmp('aphyciniTree'); var loader = aphyciniTree.getLoader(); loader.on('beforeload', function(loader, node) { this.baseParams.condition = condition; // 通过这个传递参数,这样就可以点一个节点出来它的子节点来实现异步加载 }, loader); loader.load(aphyciniTree.root); Ext.getCmp('aphyciniTree').expandAll(); } } ] });
Ext.tree.TreeLoader传参数以及异步加载
猜你喜欢
转载自kanpiaoxue.iteye.com/blog/2001018
今日推荐
周排行