Related to issue 20192: adding a parameter to setFieldFormProperties
authorGuillermo Álvarez de Eulate <guillermo.alvarez@openbravo.com>
Tue, 24 Apr 2012 17:06:29 +0200
changeset 16194 8f215938f06a
parent 16193 db21123a50b0
child 16195 2580ff5d8c68
Related to issue 20192: adding a parameter to setFieldFormProperties

Before the fix, when a field is not shown in form view but displayed in grid view, the property editorProperties.visible is changed by setFieldFormProperties function. This value in the property doesn't allow to the field to get the focus in grid view. To solve it, a second parameter has been added to the function and setted as true in the affected call. If the function is called without setting the new argument its behaviour will be the same as always.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Tue Apr 24 16:25:26 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Tue Apr 24 17:06:29 2012 +0200
@@ -1973,10 +1973,10 @@
     return result;
   },
 
-  setFieldFormProperties: function (fld) {
+  setFieldFormProperties: function (fld, isGridField) {
     var onChangeFunction;
 
-    if (fld.displayed === false) {
+    if (fld.displayed === false && !isGridField) {
       fld.visible = false;
       fld.alwaysTakeSpace = false;
     }
@@ -2101,12 +2101,8 @@
       fld.escapeHTML = (fld.escapeHTML === false ? false : true);
       fld.prompt = fld.title;
       fld.editorProperties = isc.addProperties({}, fld, isc.shallowClone(fld.editorProps));
-      //issue 20192: sometimes the property editorProperties.visible is changed by setFieldFormProperties
-      var prevVisible = fld.editorProperties.visible;
-      this.setFieldFormProperties(fld.editorProperties);
-      if (prevVisible !== fld.editorProperties.visible) {
-        fld.editorProperties.visible = prevVisible;
-      }
+      //issue 20192: 2nd parameter is true because fld.editorProperties is a grid property.
+      this.setFieldFormProperties(fld.editorProperties, true);
       if (fld.disabled) {
         fld.editorProperties.disabled = true;
       }