Commit 45dda6f1 authored by Augusto Mauch's avatar Augusto Mauch Committed by Asier Lostalé
Browse files

Fixes ISSUE-48341: Grid edit buttons disappear in some windows

The problem was only reproducible in grids where canvas field columns were displayed (i.e. Sales Order displays two by default, Delivery Status and Invoice Status). Those
fields are managed by Smartclient as embeddedComponents and the area that contains the two buttons that disappear (OBGridButtonsComponent) is an embeddedComponent too.
Whenever the user moves to a different row those components are recreated/recomputed (grid buttons here [1], canvas fields here [2]). Canvas fields are recomputed maintaining
the row number they belong too, while grid buttons are recreated without a record number and rely on this smartclient function [3] to be assigned one. For that function to be
executed, the first of the embedded components must have a null row number, so if there is a canvas field that happens to be the first component in the embeddedComponents array,
the grid buttons component will not be assigned a row and thus will not be displayed.

Programatically assigning a row number on [1] when recomputing the grid buttons component does not work because [3] needs to be invoked (it sets a smartclient property that is
not visible), so to fix the problem I am ensuring that when canvas fields are recomputed in [2], its row number is unset

[1] https://gitlab.com/openbravo/product/openbravo/-/blob/20904b11ad82f3cb37e2e3bce67127dedbf8d477/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js\#L4963
[2] https://gitlab.com/openbravo/product/openbravo/-/blob/20904b11ad82f3cb37e2e3bce67127dedbf8d477/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js\#L434
[3] https://gitlab.com/openbravo/tools/platform/org.openbravo.userinterface.smartclient.dev/-/blob/6b4f3f70cc3241de7eae4eba2f5e918586844729/web/org.openbravo.userinterface.smartclient/isomorphic/client/widgets/GridRenderer.js\#L2599
parent 486de4a9
......@@ -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) 2010-2020 Openbravo SLU
* All portions are Copyright (C) 2010-2022 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
......@@ -433,6 +433,7 @@ isc.OBGrid.addProperties({
recomputeCanvasComponents: function(rowNum) {
var i,
fld,
recordComponent,
length = this.getFields().length;
// remove client record components in edit mode
......@@ -440,6 +441,10 @@ isc.OBGrid.addProperties({
fld = this.getFields()[i];
if (fld.clientClass) {
this.refreshRecordComponent(rowNum, i);
recordComponent = this.getRecordComponent(rowNum, i);
if (recordComponent) {
recordComponent.rowNum = null;
}
}
}
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment