IDEMPIERE-3179:record should move to editing mode when user is editing first field

This commit is contained in:
hieplq 2016-09-04 10:51:01 +07:00
parent 60cc3c8364
commit 9dccd57617
3 changed files with 37 additions and 3 deletions

View File

@ -240,5 +240,10 @@ public class ADWindowContent extends AbstractADWindowContent
SessionManager.getSessionApplication().getKeylistener().removeEventListener(Events.ON_CTRL_KEY, content);
} catch (Exception e){}
}
}
@Override
protected void switchEditStatus(boolean editStatus) {
layout.setWidgetOverride("isEditting", "'" + String.valueOf(editStatus) + "'");
}
}

View File

@ -267,6 +267,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/
protected abstract IADTabbox createADTab();
protected abstract void switchEditStatus(boolean editStatus);
private void focusToActivePanel() {
IADTabpanel adTabPanel = adTabbox.getSelectedTabpanel();
focusToTabpanel(adTabPanel);
@ -1556,10 +1558,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
adTabbox.updateDetailPaneToolbar(changed, readOnly);
}
toolbar.enableIgnore(adTabbox.needSave(true, false) ||
boolean isEditting = adTabbox.needSave(true, false) ||
adTabbox.getSelectedGridTab().isNew() ||
(adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew()));
(adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew());
toolbar.enableIgnore(isEditting);
switchEditStatus (isEditting);
if (changed && !readOnly && !toolbar.isSaveEnable() ) {
if (tabPanel.getGridTab().getRecord_ID() > 0) {
if (adTabbox.getSelectedIndex() == 0 && !detailTab) {

View File

@ -40,6 +40,30 @@ Copyright (C) 2007 Ashley G Ramdass.
}
});
zk.afterLoad('zul.wgt', function () {
// should filter out for only component inside standard window or component wish fire this event,
// or ever rise other event like start editting to distinguish with true onChange event
zk.override(zul.inp.InputWidget.prototype, "doInput_", function (evt) {
this.$doInput_(evt);
var domElemOfLayout = jq('#' + this.$n().id).closest(".adwindow-layout");
if (domElemOfLayout == null){
;// do nothing
}else{
var winLayoutWg = zk.Widget.$(domElemOfLayout);
if (winLayoutWg == null){
;// do nothing
}else{
var isEditting = winLayoutWg.get ("isEditting");
// winLayoutWg should cache to improve perfomance
if (isEditting == "false"){
zAu.send(new zk.Event(zk.Widget.$(this), 'onChange',{"value":this.$n().value}));//fire change event to move to edit
}
}
}
});
});
zk.afterLoad('zul.mesh', function () {
zk.override(zul.mesh.Paging.prototype, "bind_", function () {