如何禁用 jsTree 上的热键(arrowKeys)?
How to disable hotkeys (arrowKeys) on jsTree?
我只想禁用 jsTree 视图上的右箭头键。我试图用 'hotkey'
禁用它
$('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
})
没用。然后我试了
$('#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;
}
});
这也不行。在文档中它说
To override any of those - just specify your own function, to disable - just set to false.
但我无法让它工作。你能帮我吗?谢谢
我已经使用来自 jsTree api 的 $.jstree.defaults.core.keyboard
解决了问题,而不是 'Hotkeys' 插件。 Hotkeys插件内置在jsTree中。
所以它会在核心
$('#folder').jstree({
'core':{
'keyboard':{'right':false},
'themes': { "icons": true},
'data': {
"dataType": "json"
}
})
我只想禁用 jsTree 视图上的右箭头键。我试图用 'hotkey'
禁用它$('#folder').jstree({
'hotkeys':{'right':false},
'core':{ 'themes': { "icons": true }}
})
没用。然后我试了
$('#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;
}
});
这也不行。在文档中它说
To override any of those - just specify your own function, to disable - just set to false.
但我无法让它工作。你能帮我吗?谢谢
我已经使用来自 jsTree api 的 $.jstree.defaults.core.keyboard
解决了问题,而不是 'Hotkeys' 插件。 Hotkeys插件内置在jsTree中。
所以它会在核心
$('#folder').jstree({
'core':{
'keyboard':{'right':false},
'themes': { "icons": true},
'data': {
"dataType": "json"
}
})