details:   https://code.openbravo.com/erp/devel/pi/rev/b3671e259f50
changeset: 23863:b3671e259f50
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Jun 24 12:10:40 2014 +0200
summary:   Fixes issue 26898: Tree node is not hidden after being moved to the 
root

If a tree node if moved to the root, the tree cache is invalidated to force 
redrawing it. Otherwise, the new root node is not shown until the tree is 
manually refreshed.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js
 |  20 ++++++---
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (30 lines):

diff -r 400fab36bc29 -r b3671e259f50 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js
        Tue Jun 24 10:39:45 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js
        Tue Jun 24 12:10:40 2014 +0200
@@ -135,13 +135,19 @@
       // the new callback checks if the node movement has to be reverted
       var newCallback = function (dsResponse, data, dsRequest) {
           var i, node, parentNode;
-          for (i = 0; i < data.length; i++) {
-            node = data[i];
-            if (node.revertMovement) {
-              parentNode = dsRequest.dragTree.find('id', node.parentId);
-              if (parentNode) {
-                // move the node back to its previous index
-                dsRequest.dragTree.move(node, parentNode, node.prevIndex);
+          if (dsRequest.newParentNode && dsRequest.dragTree && 
dsRequest.newParentNode.nodeId === dsRequest.dragTree.rootValue) {
+            // if the node is being moved to the root, reload the grid to force
+            // displaying properly the node in its new position. see issue 
https://issues.openbravo.com/view.php?id=26898
+            dsRequest.dragTree.invalidateCache();
+          } else {
+            for (i = 0; i < data.length; i++) {
+              node = data[i];
+              if (node.revertMovement) {
+                parentNode = dsRequest.dragTree.find('id', node.parentId);
+                if (parentNode) {
+                  // move the node back to its previous index
+                  dsRequest.dragTree.move(node, parentNode, node.prevIndex);
+                }
               }
             }
           }

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to