Skip to content Skip to sidebar Skip to footer

JsTree Show/hide Nodes

I'm working with jstree and I would like to know how to hide/show nodes if possible. I gave the list items a 'cat' id to select them with jquery but this doesn't work. Here's the

Solution 1:

It seems at your code that you are generating li elements with an ID composed by a IPC Symbol value plus a black space, plus the word "cat".

<li id="{{ ipc.symbol }} cat" rel="node-type">

But, your selector is trying to get an element whose ID is exactly "cat"

$("#cat").slice(5, 10).hide(); //Hide some nodes 

Maybe you could use a different jQuery selector. By the example, Attribute Contains Selector:

$("li[id*='cat']").slice(5, 10).hide(); //Hide nodes with the string 'cat'

Or the Attribute Contains Word Selector, more appropriate in this case (because you are looking for a whole word):

$("li[id~='cat']").slice(5, 10).hide(); //Hide nodes containing the word 'cat'

Post a Comment for "JsTree Show/hide Nodes"