Ian newbie to jquery, iam working with jstree. I am able to create tree with first of values but iam able to create childnodes to the childs present in the same tree.
i could do this
myttree
mytreeval1
mytreeval2
mytreeval2
but i couldnot do this through code
myttree
mytreeval1
subtreeval
subtreeval
mytreeval2
mytreeval2
i tried the following code.
$('#jstreedemo').jstree('create_node', 1, 'inside', 'mytreeval1', node_callback(), true); function node_callback(){alert("Iam here");}
creating tree and adding nodes are in different functions();
How to acheive this? anyone help me out with this.
this has worked for me
var position = 'inside';
var parent = $('#jstreedemo').jstree('get_selected');
var newNode = { state: "open", data: {'mydata'} };
$('#jstreedemo').jstree("create_node", parent, position, newNode, false, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With