jsTree UI - how to make only child nodes selectable

2,917 views
Skip to first unread message

mark.t.m...@googlemail.com

unread,
Mar 10, 2011, 5:09:20 AM3/10/11
to jsTree
I'm following the documentation example: http://www.jstree.com/documentation/ui

Is there a way to make only child nodes selectable (i.e. if a node has
children, it shouldn't be selectable)?

mark.t.m...@googlemail.com

unread,
Mar 10, 2011, 8:35:16 AM3/10/11
to jsTree
I've managed this now using the types plug-in instead.

mvwd

unread,
Mar 14, 2011, 6:37:37 PM3/14/11
to jsTree
...you can use .is_leaf() for checking if the selected node is a child-
node (leaf) or not. Returning false in 'before'-Event will reject
selecting the node.


$('#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;
}
})
.jstree({ ...core... });

Markus.

On 10 Mrz., 11:09, "mark.t.macdon...@googlemail.com"

Peter Robles

unread,
Jun 1, 2015, 3:35:26 PM6/1/15
to jst...@googlegroups.com, mark.t.m...@googlemail.com


On Thursday, 10 March 2011 13:35:16 UTC, mark.t.m...@googlemail.com wrote:
I've managed this now using the types plug-in instead.

How did you do it using Types?
Please post your types conf.

Thank you!
Reply all
Reply to author
Forward
0 new messages