JSTree:单击而不是双击时使节点展开?
我一生都无法弄清楚这一点,但我正在尝试配置我的 JSTree 以覆盖双击事件,因此它只是单击事件。这是添加到回调配置中的东西吗?我不知道该怎么做,我需要编辑 JSTree 源代码吗?此处的文档: http://docs.planbleu .org/modules/webportal/jquery/jsTree.v.0.9.5/documentation/#configuration
我尝试在源代码中将“ondblclk”更改为“click”,然后添加一个“click”回调选项配置设置,它什么也没做...但我可能做错了。
I can't figure this out for the life of me but I am trying to configure my JSTree to override the double click event so it is just single click event. Is this something added to the callback configuration? I am not sure how to do this, will I need to edit the JSTree source code? Documentation here: http://docs.planbleu.org/modules/webportal/jquery/jsTree.v.0.9.5/documentation/#configuration
I tried changing the "ondblclk" to "click" in the source code and then adding a "click" callback option to the config settings and it did nothing... I am probably doing it wrong though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我在 github 上的插件问题中找到了正确答案。上面的答案不起作用。这绝对有效,并且是关于如何调用插件以及如何使其使用单击展开而不是双击的全面答案。
这里是作者提到解决方案的链接,以防您需要。
I found the correct answer in an issue for the plugin on github. The above answers do NOT work. This absolutely works and is a comprehensive answer on how to call the plugin, and how to make it use single-click expand instead of double-click.
Here is a link to where the author mentions the solution, in case you need it.
将其发送到树创建函数中就可以了:(
其中 t 是对树的引用)
sending this into the tree creation function did the trick:
(where t is the reference to the tree)
这可能会让您朝着正确的方向开始。您可能需要根据元数据过滤出要扩展或不扩展的内容。
This might get you started in the right direction. You'll probably need to filter out which ones to expand or not depending on meta data.