Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
59
rated 0 times [  65] [ 6]  / answers: 1 / hits: 9516  / 11 Years ago, wed, january 8, 2014, 12:00:00

I have a jstree set up (on div id =surveyManager). And i have bound the dbclick and rename function to it as under:



 .bind(rename.jstree, function (node, data) {
edit_node(node,data);
}),

.bind(dblclick.jstree, function (event) {
//Double Click to Rename
jQuery(#surveyManager).jstree(rename);
})


over here edit_node is a function that have to implement to pass all the node information thru an ajax call.



Is it possible to setup the tree, such that on dbclick, instead of renaming the node, i can just trigger the edit_node(node,data). Maybe another jstree function , or somewhereelse i could define it. Please help


More From » jquery

 Answers
6

I'm answering my own question here, which i figured out by trying a few other things out.
Instead of having a rename function on double click for editing, we can pretty much have a select_node and edit item.



the parameters passed are event and data. we can use the event.target to get the nodal information and data is already provided, enabling us to simply call the other function .



.bind(select_node.jstree, function (e,data) {
var node = $(e.target).closest(li);
edit_node(node,data);
});


Thanks for the help


[#48889] Tuesday, January 7, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mathewb

Total Points: 535
Total Questions: 95
Total Answers: 96

Location: British Indian Ocean Territory
Member since Fri, Oct 15, 2021
3 Years ago
;