treejs icon indicating copy to clipboard operation
treejs copied to clipboard

expand the tree only one level

Open swana1337 opened this issue 4 years ago • 2 comments

is there a possible way that i can expand just one level of the tree ? so my tree has like 5 levels and i only want to open one level at a time? is there a possible way to do so ?

my tree looks like this:

root sublevel1 sublevel2

if i click on the root node i just want sublevel 1 to appear, but everytime all nodes appear.

thanks! :)

swana1337 avatar Sep 20 '21 12:09 swana1337

After init of tree i added:

$('.treejs-switcher').each(function() { if (!$($(this)[0].parentNode).hasClass('treejs-node__close')) { $($(this)[0].parentNode).addClass('treejs-node__close') } });

Not very elegant but does the trick...

con0aks avatar Feb 11 '22 17:02 con0aks

After init of tree i added:

$('.treejs-switcher').each(function() { if (!$($(this)[0].parentNode).hasClass('treejs-node__close')) { $($(this)[0].parentNode).addClass('treejs-node__close') } });

Not very elegant but does the trick...

Thank you!

jirapetr avatar Aug 03 '22 11:08 jirapetr