I have to show only selected nodes and parents, and hide rest nodes.
There is no get_unchecked in current documentation. My json format is huge so taking it in string and formatting and reloading tree will be inefficient.
Is there a way to get all unchecked nodes and hide it? if there is i can check all parent node of current checked node and then just hide all unchecked nodes, but i cannot find any method to retrive all unchecked nodes.
Work around for the question i made.
$('#jstree_demo_div').on('loaded.jstree', function(e, data) {
console.log("loaded");
checked_ids = $('#jstree_demo_div').jstree('get_selected', true);
$("#jstree_demo_div").jstree('select_all');
$.each(checked_ids, function(index, value) {
$("#jstree_demo_div").jstree('deselect_node', value);
uiParentsShow(value);
});
checked_ids = $('#jstree_demo_div').jstree('get_selected', true);
$.each(checked_ids, function(index, value) {
$("#jstree_demo_div").jstree('hide_node', value);
});
});
function uiParentsShow(node) {
try {
var parent = $("#jstree_demo_div").jstree('get_parent', node);
$("#jstree_demo_div").jstree('deselect_node', parent);
if (parent != '#') {
uiParentsShow1(parent);
}
} catch (err) {
console.log('Error in uiGetParents' + err);
}
}
Steps: