Fixes issue 28246: Grid parameters are loaded even if they have display logic
authorAugusto Mauch <augusto.mauch@openbravo.com>
Wed, 26 Nov 2014 10:34:40 +0100
changeset 25404 757e2d4d064c
parent 25403 3a46fd99fd7d
child 25405 a72704b89964
Fixes issue 28246: Grid parameters are loaded even if they have display logic

The problem was that the grid parameters were only being automatically loaded when they did not have display logic. If they had display logic the user had either to programatically load the grid, or change the grid filter editor.

To fix this, now it is detected when a grid is shown for the very first time (in that case its data property will not be a ResultSet, as it has not been loaded yet), and it is loaded then.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Tue Nov 25 20:53:08 2014 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Wed Nov 26 10:34:40 2014 +0100
@@ -190,9 +190,15 @@
       } catch (_exception) {
         isc.warn(_exception + ' ' + _exception.message + ' ' + _exception.stack);
       }
-      if (originalShowIfValue && item.defaultFilter !== null && !isc.isA.emptyObject(item.defaultFilter) && item.getType() === 'OBPickEditGridItem') {
-        item.canvas.viewGrid.setFilterEditorCriteria(item.defaultFilter);
-        item.canvas.viewGrid.filterByEditor();
+      if (item.getType() === 'OBPickEditGridItem') {
+        if (originalShowIfValue && item.defaultFilter !== null && !isc.isA.emptyObject(item.defaultFilter)) {
+          item.canvas.viewGrid.setFilterEditorCriteria(item.defaultFilter);
+          item.canvas.viewGrid.filterByEditor();
+        } else if (originalShowIfValue && item.canvas && item.canvas.viewGrid && !isc.isA.ResultSet(item.canvas.viewGrid.data)) {
+          // if the item is a grid that has display logic and is being displayed for the 
+          // first time (its data is not a ResultSet), load it 
+          item.canvas.viewGrid.refreshGrid();
+        }
       }
       if (this.view && this.view.theForm) {
         this.view.theForm.markForRedraw();