Extjs:如何在树图标上触发事件
我的树加载速度非常慢,因为在centerpanel中单击每个节点都会创建tabpanel。现在,我想更改代码,如在节点/图标上单击“仅加载子节点”。双击节点加载选项卡面板。i、 我想先把我的树装上Extjs:如何在树图标上触发事件,extjs,Extjs,我的树加载速度非常慢,因为在centerpanel中单击每个节点都会创建tabpanel。现在,我想更改代码,如在节点/图标上单击“仅加载子节点”。双击节点加载选项卡面板。i、 我想先把我的树装上 treePanel.on('expand',function(node){ alert("Expand event") var iconClass=node.getUI().getIconEl().className; node.getUI().getIconEl().clas
treePanel.on('expand',function(node){
alert("Expand event")
var iconClass=node.getUI().getIconEl().className;
node.getUI().getIconEl().className="x-tree-node-icon loading_icon";
var ajaxReq = ajaxRequest(node.attributes.url,0,"GET",true);
ajaxReq.request({
success: function(xhr) {
var response=Ext.util.JSON.decode(xhr.responseText);
appendChildNodes(response.nodes,node); //method to add child nodes
node.expand();
node.getUI().getIconEl().className=iconClass;
},
failure: function(xhr){
Ext.MessageBox.alert( _("Failure") , xhr.statusText);
node.getUI().getIconEl().className=iconClass;
}
});
});
rootNode.firstChild.fireEvent('expand',rootNode.firstChild);
您可以在加载前捕获:
tree.on('beforeload',函数(oStore,oooperation,oOpts){}
负载:
tree.on('load',函数(oStore,oNode,oNodes){}
对于图标:
tree.on('expand',function(oNode,arChildren){}
然后获取一个节点并更改图标:
oNode.set('icon',…);
我不知道您在这里真正想要什么,提供一些代码,我可能会删除下一票。我想在单击树图标时添加子节点。然后单击节点我想在中心添加选项卡面板。我尝试了上面的代码。它对我无效。单击树图标(即文件夹\+\-图标)时扩展事件力发生。我已附加上述代码。请检查我正在等待。任何人都知道。:(您的成功回调触发还是失败?如果成功,响应中的内容是什么?
?您是否获得有效的节点数据?这两个数据都不会被调用。单击图标时,它根本不会扩展事件。