IDEMPIERE-3426:improve tab behavior

combobox keystrock issue
This commit is contained in:
hieplq 2017-07-18 11:09:56 +07:00
parent a864e8b58a
commit 6bcfbaae8e
2 changed files with 20 additions and 1 deletions

View File

@ -97,6 +97,7 @@ zkforge.KeyListener = zk.$extends(zul.Widget, {
evt.preventDefault();
// _autoBlur = true will let current focus control blur but this event is sent after key event, so haven't valuable
if (zk.currentFocus)//just need to raise it when have control got focus, other NPE
id.zk.Extend.fakeOnchange (zk.currentFocus);
zAu.send(new zk.Event(zk.Widget.$(this), 'onCtrlKey', {keyCode: keycode, ctrlKey: evt.ctrlKey, shiftKey: evt.shiftKey, altKey: evt.altKey}, {toServer: true}));

View File

@ -163,6 +163,24 @@ Copyright (C) 2007 Ashley G Ramdass.
this.domUnlisten_(this.$n(), "onChange", "onAutofill"); //unlisten
});
zk.override(zul.inp.Combobox.prototype, "doKeyDown_", function (evt) {
// avoid confuse of idempiere shortcut key and function key of combobox
if ( (evt.altKey || evt.ctrlKey || evt.shiftKey) &&
(evt.keyCode == 33 || evt.keyCode == 34 || evt.keyCode == 35 || evt.keyCode == 36 || evt.keyCode == 38 || evt.keyCode == 40 || evt.keyCode == 37 || evt.keyCode == 39) ){//page up | page down | end | home | up | down | left | write
if (this.isOpen())//close drop down if already open. it will let combobox select current item, it's consistent with lost focus
this.close({sendOnOpen: true});
return;
// TODO:current idempiere use alt + down/up to move child parrent tab, but combobox also use it to open, close drop down
// at the moment, idempiere shortcut is more useful, so just get it work
}else{
this.$doKeyDown_(evt);
}
});
});
zk.afterLoad('zul.mesh', function () {