How to disable hotkeys (arrowKeys) on jsTree?

Viewed 616

I just want to disable right arrow key on jsTree view. I have tried to disable it with 'hotkey'

$('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
})

It didn't work. Then I tried

 $('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
}).keydown(function(e){
    // right arrow
    if ((e.keyCode || e.which) == 39)
    {
      e.preventDefault()
      e.stopImmediatePropagation() 
      e.stopPropagation()
      e.detail.keyboardEvent.preventDefault();
      return false;

    } 
  });

This doesn't work either. In documentation it says

To override any of those - just specify your own function, to disable - just set to false.

But i couldn't make it work. Can you help me please on this ? Thank you

1 Answers

I have solved the problem with $.jstree.defaults.core.keyboard from jsTree api, not with 'Hotkeys' plugin. Hotkeys plugin is built in jsTree.

So it would be in core

$('#folder').jstree({
'core':{
    'keyboard':{'right':false}, 
    'themes': { "icons": true},
    'data': {
        "dataType": "json"
    }
})
Related