gb5256
gb5256

Reputation: 191

JStree: how to create a child node to be the first child

I am trying to find a way to create a child node (with .jstree("create", null, "inside", ....). But this will create a new node as the last of all existing children.

Is it possible to force to add the new node as the (new) first child?

Upvotes: 1

Views: 988

Answers (1)

oerl
oerl

Reputation: 1224

I used this code:

$('#jstree').jstree(true).create_node('#', //parent node, '#' for root
          "new first node",                //data of the node
          "first"                          //position of the new node: first, last
          );

Also please check out the jsTree API.

HTH

Upvotes: 2

Related Questions