← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4827: (DV) Tree panel behaviour improved.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4827 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-10-04 18:35:24 +0200
message:
  (DV) Tree panel behaviour improved.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-10-04 15:49:35 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-10-04 16:34:11 +0000
@@ -227,6 +227,7 @@
                         selection = treepanel.getSelectionModel().getSelection();
                     if (!selection.length) {
                         selection = [treepanel.getRootNode()];
+                        treepanel.selectRoot();
                     }
                     Ext.Array.each(selection, function(r) {
                         a.push('organisationUnitIds=' + r.data.id);
@@ -239,6 +240,7 @@
                         selection = treepanel.getSelectionModel().getSelection();
                     if (!selection.length) {
                         selection = [treepanel.getRootNode()];
+                        treepanel.selectRoot();
                     }
                     Ext.Array.each(selection, function(r) {
                         a.push(r.data.text);
@@ -1271,9 +1273,12 @@
                                         width: DV.conf.layout.west_cmp_width,
                                         autoScroll: true,
                                         multiSelect: true,
+                                        isRendered: false,
                                         selectRoot: function() {
-                                            if (!this.getSelectionModel().getSelection().length) {
-                                                this.getSelectionModel().select(this.getRootNode());
+                                            if (this.isRendered) {
+                                                if (!this.getSelectionModel().getSelection().length) {
+                                                    this.getSelectionModel().select(this.getRootNode());
+                                                }
                                             }
                                         },
                                         store: Ext.create('Ext.data.TreeStore', {
@@ -1297,7 +1302,9 @@
                                 listeners: {
                                     expand: function(fs) {
                                         DV.util.fieldset.collapseOthers(this.name);
-                                        fs.down('treepanel').selectRoot();
+                                        var tp = fs.down('treepanel');
+                                        tp.isRendered = true;
+                                        tp.selectRoot();
                                     }
                                 }
                             }