fixes bug 40463: UI broken after creating a new row and filtering before saving
authorCarlos Aristu <carlos.aristu@openbravo.com>
Tue, 11 Jun 2019 17:05:05 +0200
changeset 36126 eb4807b14aa9
parent 36125 41168307539b
child 36127 f90da150f6a7
fixes bug 40463: UI broken after creating a new row and filtering before saving

Fixed the issue by saving the record properly before performing the filter. This logic was already implemented but the edited record was not being properly completed before saving. To fix this problem we force the closing of the inline editor before filtering. Note that something similar is done when editing a new record and without saving it, another record is clicked (See handleRecordSelection function of OBViewGrid).

Together with this, an additional change has been applied to the "editComplete" function. In some cases it is necessary to force an update of the focus cell value (See[1]). When setting that value, we are now directly invoking "this.getRecord()" instead of using the value retrieved at the top of the function. This is done to prevent setting a wrong value if the record values change in the middle of the execution of the "editComplete" function.

[1] https://issues.openbravo.com/view.php?id=25028
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Tue Jun 11 17:06:27 2019 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Tue Jun 11 17:05:05 2019 +0200
@@ -2079,6 +2079,7 @@
     callback = function () {
       delete me.isFilteringExternally;
     };
+    this.closeAnyOpenEditor();
     if (isc.isAn.Array(this.data) || (this.data.willFetchData && this.data.willFetchData(this.convertCriteria(criteria)))) {
       // Use this flag when a filter editor submit results a datasource request
       // This flag will be used to prevent unneeded datasource requests, see https://issues.openbravo.com/view.php?id=29896
@@ -3289,7 +3290,7 @@
     // Update the focus cell value if different from edit form values.
     // To avoid the case where sometimes data updated through trigger is not showing up without refreshing.
     // Refer issue https://issues.openbravo.com/view.php?id=25028
-    this.setEditValue(rowNum, this.getField(colNum).name, record[this.getField(colNum).name], true, true);
+    this.setEditValue(rowNum, this.getField(colNum).name, this.getRecord(rowNum)[this.getField(colNum).name], true, true);
 
     if (this.getEditRow() === rowNum) {
       this.getEditForm().markForRedraw();