details: https://code.openbravo.com/erp/devel/pi/rev/71227823d930 changeset: 28063:71227823d930 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri Nov 27 12:19:15 2015 +0100 summary: fixes issue 31566: Error when closing window having focus on a yes/no filter
When closing the tab having the focus on a OBYesNoItem, the handleEditorExit() method of this class is executed, causing an unexpected javascript error on the getCriteriaFieldName() method, because is not possible to reference the form as it is being destroyed. It does not make sense to execute handleEditorExit() when closing (destroying) the window. So to avoid this execution we introduce a new flag for the items (isBeingDestroyed) to mark that they are being destroyed. Thus, it is used for OBYesNoItem to identify whether standard handleEditorExit() flow must be executed or not. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-yesno.js | 10 +++++++++- modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js | 1 + 2 files changed, 10 insertions(+), 1 deletions(-) diffs (38 lines): diff -r 92d905a6c013 -r 71227823d930 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-yesno.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-yesno.js Thu Nov 26 17:08:45 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-yesno.js Fri Nov 27 12:19:15 2015 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2011-2012 Openbravo SLU + * All portions are Copyright (C) 2011-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -37,6 +37,14 @@ } }, + handleEditorExit: function () { + if (this.isBeingDestroyed) { + return; + } else { + this.Super('handleEditorExit', arguments); + } + }, + // is needed because addUnknownValues is false isUnknownValue: function (enteredValue) { var i, vm = this.getValueMap(); diff -r 92d905a6c013 -r 71227823d930 modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js --- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Thu Nov 26 17:08:45 2015 +0100 +++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Fri Nov 27 12:19:15 2015 +0100 @@ -592,6 +592,7 @@ this.dataSource.destroy(); this.dataSource = null; } + this.isBeingDestroyed = true; this._original_destroy(); }, ------------------------------------------------------------------------------ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits