Within my JStree i want the user to only be able to select leafs of the tree. E.g.: Nodes that have no childs. My idea is to bind the select event and manually check whether the selected node has childs and then select/not select the node accordingly.
Is there a simpler way? or is this obvious solution the only one?
2014 - version 3.0.1
$('#jstree').on('activate_node.jstree', function(e, data) {
if(data.instance.is_leaf(data.node)) {
...
}
});
You can use
In the code.
$('#treeID')
.bind('before.jstree', function(event, data){
switch(data.plugin){
case 'ui':
if(data.inst.is_leaf(data.args[0])){
return false;
}
break;
default:
break;
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With