dojo tree event on root nodes

匆匆过客 提交于 2019-12-12 04:43:30

问题


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

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.

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


回答1:


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

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.



来源:https://stackoverflow.com/questions/4800261/dojo-tree-event-on-root-nodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!