details:   https://code.openbravo.com/erp/devel/pi/rev/4639ca577e0b
changeset: 23859:4639ca577e0b
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Mon Jun 23 16:17:36 2014 +0200
summary:   [treeimpr] Related to issue 26455: 'Default Tree View Logic' now 
only affects
to the child views of the view where it applies. This is to fix the case where 
you cannot manually
change between the tree/grid view mode and then move to another different 
record (inside the same view)
preserving the previous manually set mode.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 |  42 +++++++--
 1 files changed, 30 insertions(+), 12 deletions(-)

diffs (72 lines):

diff -r e3da458ad088 -r 4639ca577e0b 
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
 Sun Jun 22 12:27:58 2014 +0530
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Mon Jun 23 16:17:36 2014 +0200
@@ -389,10 +389,25 @@
 
   },
 
-  handleDefaultTreeView: function (parentContextInfo) {
+  // ** {{{ handleDefaultTreeView }}} **
+  //
+  // Evaluates the 'Default Tree View Logic' to show the grid view or the tree 
view
+  //
+  // Parameters:
+  // * {{{handleCurrent}}}: 'false' by default. It specifies if the logic 
should be applied in current record.
+  // * {{{handleChilds}}}: 'true' by default. It specifies if the logic should 
be applied in child records.
+  // * {{{parentContextInfo}}}: the context info of the parent. To ensure that 
the childs (if 'handleChilds' is 'true') have also the context info of its 
parent.
+  handleDefaultTreeView: function (handleCurrent, handleChilds, 
parentContextInfo) {
     var contextInfo, tabViewPane, length, i, p;
     contextInfo = this.getContextInfo(false, true, true);
 
+    if (!handleCurrent) {
+      handleCurrent = false;
+    }
+    if (!handleChilds) {
+      handleChilds = true;
+    }
+
     for (p in parentContextInfo) {
       // While evaluating the 'defaultTreeViewLogicIf' the parent contextInfo 
is needed
       // because based on the parent selected record, the current view will be 
shown
@@ -402,27 +417,30 @@
       }
     }
 
-    if (this.treeGrid && isc.isA.Function(this.defaultTreeViewLogicIf)) {
-      if (this.defaultTreeViewLogicIf(contextInfo)) {
-        if (!this.isShowingTree) {
-          if (this.treeGrid.getDataSource()) {
-            OB.ToolbarUtils.showTreeGrid(this);
-          } else {
-            this.defaultTreeView = true;
+    if (handleCurrent) {
+      if (this.treeGrid && isc.isA.Function(this.defaultTreeViewLogicIf)) {
+        if (this.defaultTreeViewLogicIf(contextInfo)) {
+          if (!this.isShowingTree) {
+            if (this.treeGrid.getDataSource()) {
+              OB.ToolbarUtils.showTreeGrid(this);
+            } else {
+              this.defaultTreeView = true;
+            }
           }
+        } else if (this.isShowingTree) {
+          OB.ToolbarUtils.hideTreeGrid(this);
         }
-      } else if (this.isShowingTree) {
-        OB.ToolbarUtils.hideTreeGrid(this);
       }
     }
 
-    if (this.childTabSet) {
+
+    if (handleChilds && this.childTabSet) {
       length = this.childTabSet.tabs.length;
       for (i = 0; i < length; i++) {
         tabViewPane = this.childTabSet.tabs[i].pane;
         if (tabViewPane.handleDefaultTreeView) {
           this.addPreferenceValues(contextInfo, tabViewPane);
-          tabViewPane.handleDefaultTreeView(contextInfo);
+          tabViewPane.handleDefaultTreeView(true, true, contextInfo);
         }
       }
     }

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to