Reputation: 11
I would like to deselect some selected nodes in JSTree based on the user selection. If the user selected 2 child nodes with similar category. I would like to programmatically deselect the 1st node the user selected.
Thanks in advance for the help. Hope you can help me figure out the solution.
Regards, Michael
Upvotes: 1
Views: 5257
Reputation: 5061
You can place this testing into select_node
event and see if you need to unselect something. E.g. the code below tests if there is more than one node selected and unselects the first one. Check demo - codepen.
.on('select_node.jstree', function(e, data){
var countSelected = data.selected.length;
if (countSelected>1) {
data.instance.deselect_node( [ data.selected[0] ] );
}
})
Upvotes: 1