ExtJS:在TreePanel中为节点添加单击单击操作 [英] ExtJS: Add Single Click Action To A Node In A TreePanel

查看:392
本文介绍了ExtJS:在TreePanel中为节点添加单击单击操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[修订]
我正在ExtJs中创建一个TreePanel,它正在从JSON文件加载其子节点。我无法向节点添加点击动作。我不知道它是添加在创建树的脚本中,还是将它作为JSON中的属性添加,如果是这样,语法将是什么。任何帮助将不胜感激!请尽可能提供一个例子。

解决方案

将一个监听器添加到TreePanel中:

  listeners:{
click:function(node,event){
console.log(node);
}
}

并使用节点中的数据。 >

[revised] I'm creating a TreePanel in ExtJs that is loading its children from a JSON file. I'm having trouble adding a click action to the nodes. I'm not sure whether it's added in the script creating the tree, or if its added as a property in the JSON, and if so, what the syntax would be. Any help would be appreciated! Please provide an example if possible.

解决方案

Add a listener to the TreePanel:

listeners: {
    click: function(node, event){
        console.log(node);
    }
}

and use the data in the node.

这篇关于ExtJS:在TreePanel中为节点添加单击单击操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆