how to get node on double click?

938 views
Skip to first unread message

oda

unread,
Apr 16, 2014, 9:09:46 AM4/16/14
to jst...@googlegroups.com
Hi I had resolved the question with the code at the end... but 
how can I do the same thing using callback option?
I tried some example but it deosnt works!
for example "alert('ok') is never runned (int the following code):




 jQuery('#nomeAlbero').jstree({
                    "callback": {
                                    "onclick" : function(node)
                                                    {
                                                        alert('ok!!!');
                                                    }
                    },
                'core':{
                        'data': response,
                        "animation" : 400,
                        "multiple" : false,
                        "check_callback" : true
                    },
                    "plugins" : ["search"]

                });
               

                $('#nomeAlbero').on('dblclick', function(event){
                    var ref= $('#nomeAlbero').jstree(true);
                    sel = ref.get_selected();
                    sel = sel[0];
                    alert('you doubleclick on :'+sel);
                });


Thank you in advance,
Oda

Ivan Bozhanov

unread,
Apr 16, 2014, 9:18:09 AM4/16/14
to jst...@googlegroups.com
Why would you expect this to work? Is there a config option named "callback" on jstree? Sorry, but wishful thinking will not get you far as a programmer.
Either use the code you have used below, but instead of "dblclick" bind to "click" ... that should be pretty obvious.
Or you can use the changed.jstree event:
$('#nomeAlbero').on("changed.jstree", function (e, data) {
  var sel = data.selected[0];

  alert('you doubleclick on :'+sel);
});

oda

unread,
Apr 16, 2014, 9:49:23 AM4/16/14
to jst...@googlegroups.com
> Is there a config option named "callback" on jstree?
Thank you for answering me even if my post are very silly :-P
I see "callback" at the page:

Thank you!

Ivan Bozhanov

unread,
Apr 16, 2014, 10:12:15 AM4/16/14
to jst...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages