djt
djt

Reputation: 7535

JsTree - Keep Parents Open

I'm using Jstree. I have a about 10 top-level items, all with various levels of children. I want to keep the Top Level items open, always.

Anyone know how to do this?

EDIT:

Just to clarify, even when someone clicks these items, I want them to stay open

I imagine someonething needs to go in this step of my code, Im just not sure exactly what:

.delegate(".jstree-open>a", "click.jstree", function(event){
      $.jstree._reference(this).close_node(this,false,false);

Upvotes: 0

Views: 523

Answers (1)

Gajotres
Gajotres

Reputation: 57309

I have created an example for you: http://jsfiddle.net/Gajotres/HLhys/

You need to set this option:

"initially_open": ["menu_2","menu_8"]

Set as many id's you want.

Use .reopen() on jsTreen instance if you want them to stay opened in case of node changes (or other actions ...). This method will reopen all nodes mentioned in initially_open array.

Upvotes: 1

Related Questions