details:   /erp/devel/pi/rev/adc02724e7d6
changeset: 11847:adc02724e7d6
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Tue May 03 17:37:06 2011 +0200
summary:   Fixes issue 16619: Hide sections where all fields are not visible

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
 |   3 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
        |  31 +++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r 78a7b678d239 -r adc02724e7d6 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Tue May 03 16:54:03 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Tue May 03 17:37:06 2011 +0200
@@ -415,6 +415,8 @@
   // visual state of disabled or non-disabled stays the same now
   showDisabled: false,
   
+  alwaysTakeSpace: false,
+
   // never disable a section item
   isDisabled: function(){
     return false;
@@ -482,7 +484,6 @@
       newFocusItem.focusInItem();
     }
   }
-  
 });
 
 // == OBListItem ==
diff -r 78a7b678d239 -r adc02724e7d6 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Tue May 03 16:54:03 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Tue May 03 17:37:06 2011 +0200
@@ -488,9 +488,9 @@
     }
     
     var columnValues = data.columnValues, calloutMessages = 
data.calloutMessages,
-                       auxInputs = data.auxiliaryInputValues, prop, value, i,
+                       auxInputs = data.auxiliaryInputValues, prop, value, i, 
j,
                        dynamicCols = data.dynamicCols,
-                       sessionAttributes = data.sessionAttributes;
+                       sessionAttributes = data.sessionAttributes, item, 
section;
 
     // edit row has changed when returning, don't update the form anymore
     if (this.grid && this.grid.getEditRow() !== editRow) {
@@ -571,6 +571,33 @@
       }
     }
 
+    // Hiding sections that where all fields are not visible
+    for(i = 0; i < this.getItems().length; i++) {
+      item = this.getItem(i);
+      if(item && item.getClassName() === 'OBSectionItem') {
+        section = item;
+        section.visible = false;
+        for(j = 0; j < section.itemIds.length; j++) {
+          item = this.getItem(section.itemIds[j]);
+          if(item && item.visible) {
+            section.visible = true;
+            break;
+          }
+        }
+
+        if(section.visible) {
+          continue;
+        }
+
+        for(j = 0; j < section.itemIds.length; j++) {
+          item = this.getItem(section.itemIds[j]);
+          if(item) {
+            item.alwaysTakeSpace = false;
+          }
+        }
+      }
+    }
+
     this.markForRedraw();
 
     this.view.toolBar.updateButtonState(true);

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to