Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use set_id to rename node_id in jstree?

this is my rename function, none of the options i've tried work, i do know, that set_id is the function to use but how?

 $('#jstree').on('rename_node.jstree', function (node,obj) {

    var node_id = "calculated"// calculate node_id
    // tried the following 3 options ..
   ....

     $('#jstree').jstree(true).set_id(obj,node_id); //not working

     obj.instance.set_id(this,node_id)// not working either
     obj.instance.set_id(obj,node_id)//nope..

So how do i set the node_id in jstree?

like image 685
wolfgang Avatar asked Dec 15 '22 22:12

wolfgang


1 Answers

I looked at the API http://www.jstree.com/api/#/?q=rename&f=rename_node.jstree, and I think you have to use obj.node.

$('#jstree').jstree(true).set_id(obj.node,node_id);

obj.text should contain the new name of the node, and obj.old the old name of the node.

like image 129
oerl Avatar answered Dec 17 '22 12:12

oerl