← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5509: Favorites. Work in progress.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5509 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-20 16:29:06 +0100
message:
  Favorites. Work in progress.
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-12-20 11:27:15 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-12-20 15:16:40 +0000
@@ -1058,6 +1058,7 @@
                         for (var i = 0; i < f.organisationUnits.length; i++) {
                             this.organisationunitIds.push(f.organisationUnits[i].internalId);
                             f.names.organisationunit.push(f.organisationUnits[i].name);
+                            DV.cmp.dimension.organisationunit.treepanel.storage[f.organisationUnits[i].internalId] = f.organisationUnits[i].name;
                         }
                         
                         this.series.names = f.names[this.series.dimension];
@@ -1118,7 +1119,7 @@
                     Ext.Array.each(DV.value.values, function(item) {
                         item[DV.conf.finals.dimension.data.value] = DV.util.string.getEncodedString(storage[item.d].name);
                         item[DV.conf.finals.dimension.period.value] = DV.util.string.getEncodedString(DV.util.dimension.period.getNameById(item.p));
-                        item[DV.conf.finals.dimension.organisationunit.value] = DV.cmp.dimension.organisationunit.treepanel.store.getNodeById(item.o).data.text;
+                        item[DV.conf.finals.dimension.organisationunit.value] = DV.cmp.dimension.organisationunit.treepanel.findNameById(item.o);
                         item.v = parseFloat(item.v);
                     });
                     
@@ -2129,6 +2130,7 @@
                                         autoScroll: true,
                                         multiSelect: true,
                                         isRendered: false,
+                                        storage: {},
                                         selectRoot: function() {
                                             if (this.isRendered) {
                                                 if (!this.getSelectionModel().getSelection().length) {
@@ -2136,6 +2138,17 @@
                                                 }
                                             }
                                         },
+                                        findNameById: function(id) {
+                                            var n = this.store.getNodeById(id) ? this.store.getNodeById(id).data.text : null;                                            
+                                            if (!n) {
+                                                for (var k in this.storage) {
+                                                    if (k === id) {
+                                                        n = this.storage[k];
+                                                    }
+                                                }
+                                            }
+                                            return n;
+                                        },
                                         store: Ext.create('Ext.data.TreeStore', {
                                             proxy: {
                                                 type: 'ajax',