如何在 ExtJS 4 中的树节点上设置 singleClickExpand
在 ExtJS 树上展开节点的默认操作是双击。
在版本 4 之前,TreeNode 配置中有 singleClickExpand
属性。
如何在 ExtJS 版本 4 树上应用 singleClickExpand
行为?
是否有此行为的配置属性而不设置事件侦听器?
谢谢。
The default action to expand a node on ExtJS tree is double-click.
Before version 4, there is singleClickExpand
property in TreeNode configuration.
How to apply singleClickExpand
behavior on ExtJS version 4 tree ??
Is there a configuration property for this behavior without setting event listener??
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我花了一些时间寻找同样的东西。我觉得我可以明确地回答你的问题...
不,没有它的配置选项。
我必须设置一个点击处理程序。无论如何,我需要一个来实现叶子点击的功能:
I've spent some time looking for the same thing. I feel I can definitively answer your question with...
No there isn't a config option for it.
I had to set a click handler. I needed one anyway though to implement functionality for leaf clicks:
事实上,您使用了树视图的展开功能。
只需在树面板上实现 itemclick 函数即可:
In fact you use the expand function of the treeview.
Just implement the itemclick function on you treepanel:
如果您使用键盘导航,您可能需要使用 SelectionChange 事件,以便涵盖所有场景,但无论如何,这是我在我的案例中使用的一种方法来实现 singleClick 功能。
在树中定义一个新事件,例如假设您定义了一个从树面板继承的类,那么在“initComponent”中您将创建该事件:
Ext.define('MY.view.CheckList', {
扩展:'Ext.tree.Panel',
别名: 'widget.checklist',
});
那么你需要监听你创建的事件,例如:
mytree.on("singleClick", function( tree, model, Nodes){
});
两件事:
我确信这不是最完美的解决方案,但就我而言效果很好。
哈!
If you're using keyboard navigation, you probably need to use the selectionChange event so that you cover all the scenarios, but anyway, here's an approach i'm using in my case to achieve the singleClick thingy.
define a new event in the tree, for instance imagine you have defined a class which inherits from the treepanel, then in the "initComponent" you would create the event:
Ext.define('MY.view.CheckList', {
extend: 'Ext.tree.Panel',
alias: 'widget.checklist',
});
then you need to listen to the event you created, for instance:
mytree.on("singleClick", function( tree, model, nodes){
});
2 things:
It's not the most perfect solution, i'm sure, but in my case worked fine.
HTH!