JsTree + hotkeys plugin + JQuery 1.4.2: Jumpy arrow keys

309 views
Skip to first unread message

stoffel

unread,
Feb 22, 2010, 8:02:52 AM2/22/10
to jsTree
If have just tested the last JsTree Version 0.9.9.a2 against the new
JQuery 1.4.2. Everything seems to work fine, except the hotkey plugin:
When using the arrow keys the selection jumps over 9 leafs instead of
just 1.

Here is my plain config:

$("#tree").tree({
ui : {
animation: 100,
theme_name : "mytheme"
},
types : {
"default" : {
clickable : true,
renameable : false,
deletable : false,
creatable : false,
draggable : false
}
},
callback : {
onchange : function (NODE) {
...<some code>...
}
},
plugins : {
hotkeys : {
}
}
});

stoffel

unread,
Feb 22, 2010, 10:35:37 AM2/22/10
to jsTree
There already seems to be a problem report for 1.4.2. See:

http://forum.jquery.com/topic/problem-with-bind-keydown-in-jquery-1-4-2

Think it's a Jquery problem in conjunction with the 'jquery.hotkeys'
plugin, not the 'jquery.tree.hotkeys' one.

Maybe have to wait for 1.4.3 ???

stoffel

unread,
Feb 23, 2010, 4:23:27 AM2/23/10
to jsTree
Ok,

there IS a problem with jqery.hotkeys and the new special events
system of JQuery 1.4.2. There is a solution: John Resig has rewriten
the jquery.hotkeys code, see http://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js

Of course this doesn't work out of the box with jstree, because the
old functionality is only partially implemented. So I've changed the
jquery.tree.hotkey pluging:

Line 67:
OLD $(document).bind("keydown", { combi : k, disableInInput: true },
function (event) {
NEW $(document).bind("keydown", k, function (event) {

With this fix I get a working key handling in jsTree with JQurey
1.4.2.

BUT you loose the special options 'disableInInput' (it's not
implemented any more). I have no idea if it's necessary any more!

Maybe anyone with deeper knowledge should have a look what's going
on ;-)

CU

stoffel

unread,
Feb 23, 2010, 4:27:51 AM2/23/10
to jsTree
Sorry I missed one change in jquery.tree.hotkeys.js, Line 2:

OLD if(typeof window.hotkeys == "undefined") throw "jsTree hotkeys:
jQuery hotkeys plugin not included.";
NEW if(typeof jQuery.hotkeys == "undefined") throw "jsTree hotkeys:
jQuery hotkeys plugin not included.";


On Feb 23, 10:23 am, stoffel <sskop...@web.de> wrote:
> Ok,
>
> there IS a problem with jqery.hotkeys and the new special events
> system of JQuery 1.4.2. There is a solution: John Resig has rewriten

> the jquery.hotkeys code, seehttp://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js

Reply all
Reply to author
Forward
0 new messages