简体   繁体   中英

how to make dijit tree folders selectable?

I have a tree in which i want the onOpen and onClose to be called only when the user clicks on the +/- icon and not if he clicks anywhere on the line that contains the folder. then I want the onClick event fired whenever the user clicks on the line where the folder is(except for on the expand/collapse icon). I have tried looking at the node passed to the onopen by default and also have tried looking at the node sent by the onclick. It seems that onopen ovverides onclick internally. Please give me a direction to approach this issue.

Thanks in Advance!

Looks like there is a flag you can pass to the Tree to do this:

// openOnClick: Boolean
// If true, clicking a folder node's label will open it, rather than calling onClick()
openOnClick: false,

You would use it like this:

var myTree = new Tree({
    ..., //the other arguments you are already using
    openOnClick: true
});

In the future, I recommend checking the API docs or the source code for the widgets you are using. You will find that you will often stumble across useful features like this and that the Dojo source code is well organized and easy to read so its a good place to check whenever you have a doubt about how something works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM