Hi Ivan,
My requirement is also something similar to the above problem. I want to create two sub-nodes along with the parent node on clicking the 'create' of the context menu.
For example, i want my tree something like below:-
Rule Category (node already present)
-- Rule Id (child of rule category)
- rule id one (first child of Rule id)
- rule id two (second child of Rule id)
now what I want is that when i right click on the 'Rule Category', and click on 'create' , 'Rule id' node gets created along with the 'rule id one' and 'rule id two' nodes instantly.
What I tried to do is I tried to modified the "action" of the 'create' as below, but not achieved what I wanted.
"create Rule" : {
"separator_before" : false,
"separator_after" : false,
"_disabled" : false, //(this.check("create_node", data.reference, {}, "last")),
"label" : "Create Rule",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
inst.create_node(obj, {}, "last", function (new_node) {
setTimeout(function () { inst.edit(new_node); },0);
}
);
//for socond node
var inst1 = $.jstree.reference(data.reference),
obj1 = inst1.get_node(data.reference);
inst1.create_node(obj1, {}, "last", function (new_node) {
setTimeout(function () { inst1.edit(new_node); },0);
}
);
}
},
Please provide the solution for this.
Thanks
Sakshi