Changed the Title in 2023, as it is mentioned oFF-Topic. But Wanted to Informed the functionality existed, I have worked on the functionality and replied with the answer for my question.
Please verify the fiddle https://jsfiddle.net/samueltoepke/wh72zf8b/ to better understand the issue mentioned.
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);