Reputation: 2043
$("#treeDiv").dblclick(function () {
this.rename(this.data.ui.hovered || this.data.ui.last_selected);
});
I am working on JSTree. And I tried the above code to rename the node of tree.
treeDiv
is the Id of div of tree. The above code is not working. Any body know the mistake where I did please let me know.
Upvotes: 0
Views: 364
Reputation: 4902
In above code this will be pointed to the itself and not a jstree object nor a jquery object.
This is the correct form:
$("#treeDiv")
.bind("dblclick.jstree", function (evnt) {
$(this).jstree('rename', evnt.target);
});
As a rule when you doesn't have the real jstree object (which support .rename) you should use $('#tree').jstree(command, arg)
and also, you should use events like example above.
Upvotes: 3