details: https://code.openbravo.com/erp/devel/pi/rev/afe543a30c97 changeset: 19766:afe543a30c97 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Feb 21 13:29:49 2013 +0100 summary: Fixes issue 22821: Triggers executed after entering full identifier in selector
This changeset is the same as [1] with one exception, we don't want to set the fullIdentifierEntered property to true when the user selects an option using th e selector window, because in that case setValueFromRecord has already been executed, so there is no need to do it again in the blur function. This has been f ixed by not setting the fullIdentifierEntered property if the change event was originated from the setValueFromRecord function. [1] https://code.openbravo.com/erp/devel/pi/rev/98421b2454605ceb4c47e1267a1787c74d82e169 diffstat: modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js | 26 +++++++++- 1 files changed, 24 insertions(+), 2 deletions(-) diffs (59 lines): diff -r 0d32601d0243 -r afe543a30c97 modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js --- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Thu Feb 21 10:43:08 2013 +0100 +++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Thu Feb 21 13:29:49 2013 +0100 @@ -517,6 +517,15 @@ } else { identifier = newValue; } + + // check if the whole item identifier has been entered + // see issue https://issues.openbravo.com/view.php?id=22821 + if (OB.Utilities.isUUID(this.mapDisplayToValue(identifier)) && this._notUpdatingManually !== true) { + this.fullIdentifierEntered = true; + } else { + delete this.fullIdentifierEntered; + } + //Setting the element value again to align the cursor position correctly. this.setElementValue(identifier); }, @@ -592,6 +601,7 @@ var currentValue = this.getValue(), identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, i; + this._notUpdatingManually = true; if (!record) { this.storeValue(null); this.form.setValue(this.name + OB.Constants.FIELDSEPARATOR + this.displayField, null); @@ -627,10 +637,21 @@ if (currentValue && this.form.focusInNextItem && isc.EH.getKeyName() !== 'Tab') { this.form.focusInNextItem(this.name); } + delete this._notUpdatingManually; }, - // override blur to not do any change handling - blur: function (form, item) {}, + blur: function (form, item) { + var selectedRecord; + // Handles the case where the user has entered the whole item identifier and has moved out of the + // selector field by clicking on another field, instead of pressing the tab key. in that case the change + // was not being detected and if the selector had some callouts associated they were not being executed + // See issue https://issues.openbravo.com/view.php?id=22821 + if (this.fullIdentifierEntered) { + selectedRecord = this.pickList.getSelectedRecord(); + this.setValueFromRecord(selectedRecord); + delete this.fullIdentifierEntered; + } + }, handleOutFields: function (record) { var i, j, outFields = this.outFields, @@ -712,6 +733,7 @@ var selectedRecord = this.pickList.getSelectedRecord(), ret = this.Super('pickValue', arguments); this.setValueFromRecord(selectedRecord); + delete this.fullIdentifierEntered; return ret; }, ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
