Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I attach custom behaviour to a double click in jsTree?

Tags:

I'm using the jsTree jQuery plugin and want to execute code when the user double clicks a node.

I can't seem to get it to work. I found some documentation on a ondblclk event but it doesn't fire.

    browser.jstree(             {                 plugins: ["themes", "json_data", "ui", "cookies"],                 callback:                 {                     ondblclk: function (node, tree) {                         if (!thisReportBrowserthis._isFoldersOnly) {                             var f = node;                         }                     }                 }             }         ); 

How can I handle double click events with jstree?

like image 256
John Mills Avatar asked Sep 09 '10 07:09

John Mills


1 Answers

It turns out I can do this:

jstree.bind("dblclick.jstree", function (event) {    var node = $(event.target).closest("li");    var data = node.data("jstree");    // Do my action }); 

node contains the li that was clicked and data contains the metadata with my info in it.

like image 192
John Mills Avatar answered Oct 12 '22 06:10

John Mills