I have js tree and some nodes are disabled. I want to get selected node values without disabled
nodes.
I used the following code to get selected node values, but it includes disabled values too
$(document).on('click', '#users_perm_save', function (event) {
var result = $('#jstree').jstree('get_selected');
});
What will be the reason ?
You can use Array filter method for that. Here is what you can do.
First get all the selected nodes and then filter it which is not disabled.
$(document).on('click', '#users_perm_save', function (event) {
var result = $('#jstree').jstree('get_selected',true);
var checkedNodes = result.filter((node)=>{
return node.state.disabled==false
}).map((checked)=>{
return checked.id
});
console.log(checkedNodes);
});