Fixes issue 23889: No extra datasource calls are done by selectors
authorAugusto Mauch <augusto.mauch@openbravo.com>
Tue, 28 May 2013 12:46:06 +0200
changeset 20481 a569477afae5
parent 20479 4b94b5a758f8
child 20482 7b20cf4da8ef
Fixes issue 23889: No extra datasource calls are done by selectors

Pick lists and grids use a property called drawAllMaxCells, that is used to determine how many cells should be fetched from the datasource, its default value is 250. If after making a datasource call smartclient finds out that the number of retrieved cells is lower than drawAllMaxCells, it will do another datasource call, and repeat this process until the number of cells fetched are higher than drawAllMaxCells or until all cells have been fetched.

This is not the intented behaviour, we want the rows to be fetched when the user scrolls down and is out of cached rows. That is why in the definition of OBViewGrid the drawAllMaxCells is set to 0. To fix this issue this property is also set to 0 in the selector pick list and grid.
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	Tue May 28 14:13:20 2013 +0530
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue May 28 12:46:06 2013 +0200
@@ -78,6 +78,10 @@
       selector: this.selector,
       selectionAppearance: this.selectionAppearance,
 
+      // drawAllMaxCells is set to 0 to prevent extra reads of data
+      // Smartclient will try to read until drawAllMaxCells has been reached
+      drawAllMaxCells: 0,
+
       dataProperties: {
         useClientFiltering: false,
         useClientSorting: false
@@ -458,6 +462,9 @@
 
   setUpPickList: function (show, queueFetches, request) {
     this.pickListProperties.canResizeFields = true;
+    // drawAllMaxCells is set to 0 to prevent extra reads of data
+    // Smartclient will try to read until drawAllMaxCells has been reached
+    this.pickListProperties.drawAllMaxCells = 0;
     // Set the pickListWidth just before being shown.
     this.setPickListWidth();
     this.Super('setUpPickList', arguments);