details:   https://code.openbravo.com/erp/devel/pi/rev/38cf21cbcd3d
changeset: 21115:38cf21cbcd3d
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Sep 12 12:51:28 2013 +0200
summary:   Fixes issue 24745: Columns are autofitted to fill the viewport in 
P&E grids

The field with the longest displaylength will be the one to be expanded if the 
sum of the column widths do not fill the viewport.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
 |  17 +++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r c4ab8576a7ee -r 38cf21cbcd3d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Thu Sep 12 11:09:04 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Thu Sep 12 12:51:28 2013 +0200
@@ -44,7 +44,7 @@
   minFieldWidth: 75,
   width: '100%',
   height: '100%',
-  autoFitFieldsFillViewport: false,
+  autoFitFieldsFillViewport: true,
   confirmDiscardEdits: false,
   animateRemoveRecord: false,
   removeFieldProperties: {
@@ -138,9 +138,24 @@
       window.warn('grid fiel not found!');
     }
 
+    this.autoFitExpandField = this.getLongestFieldName();
+
     this.Super('initWidget', arguments);
   },
 
+  getLongestFieldName: function () {
+    var len = this.fields.length,
+        maxWidth = -1,
+        i, longestFieldName;
+    for (i = 0; i < len; i++) {
+      if (this.fields[i].displaylength > maxWidth) {
+        longestFieldName = this.fields[i].name;
+        maxWidth = this.fields[i].displaylength;
+      }
+    }
+    return longestFieldName;
+  },
+
   // when starting row editing make sure that the current
   // value and identifier are part of a valuemap
   // so that the combo shows the correct value without 

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to