根节点上的dojo树事件 [英] dojo tree event on root nodes

查看:145
本文介绍了根节点上的dojo树事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**我正在使用以下代码构建dojo树:

**I'm building dojo tree using the following code:

树按预期显示。我的问题是onClick事件只是在叶节点上被触发。当我单击根级别节点(我有几个根级别)时,它只是显示子节点。

The tree is displayed as expected. The problem that I have is that the onClick event is only fired on leaf nodes. When I click on the root level node(I have several root level) it is just open showing child nodes.

如何将extraonClick功能添加到根目录节点?

How can I add "extra" onClick functionality to the root nodes?

推荐答案

您已经将 openOnClick 设置为true树。我认为API文档也可以这样回答。

You've got openOnClick set to true for your tree. I think the API docs answer this as well as I possibly could.

http://dojotoolkit.org/api/dijit/Tree/openOnClick

这样说,看起来你会是可以连接到 _onClick ,而不用做任何你想要的(只有当$ $ c时,负责调用 onClick 的方法$ c> openOnClick 是假的,反正)。或者,如果你想对私人会员感到有点小罪,那么你自己就是一个 dijit.Tree ,扩展 _onClick 还可以激活您定义为public的另一个功能。

That said, it looks like you'd be able to connect to _onClick instead and do whatever you want (that's the method responsible for calling onClick only when openOnClick is false, anyway). Or, if you wanted to feel a little less guilty about accessing private members, dojo.declare yourself a subclass of dijit.Tree, extending _onClick to also fire another function you define as public.

这篇关于根节点上的dojo树事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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