← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11143: (PT) Layout window bug fixed.

 

------------------------------------------------------------
revno: 11143
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-06-05 19:12:40 +0200
message:
  (PT) Layout window bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/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-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-06-03 18:55:28 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-06-05 17:12:40 +0000
@@ -3898,6 +3898,7 @@
 					objectName,
 					periodRecords,
 					fixedPeriodRecords = [],
+                    dimNames = [],
 					isOu = false,
 					isOuc = false;
 
@@ -3908,6 +3909,7 @@
 				pt.util.pivot.createTable(layout, pt);
 
 				// Set gui
+
 				xLayout = pt.util.pivot.getExtendedLayout(layout);
 				dimMap = xLayout.objectNameDimensionsMap;
 				recMap = xLayout.objectNameItemsMap;
@@ -3979,39 +3981,57 @@
 				pt.viewport.filterStore.removeAll();
 
 				if (layout.columns) {
+                    dimNames = [];
+
 					for (var i = 0, dim; i < layout.columns.length; i++) {
 						dim = dimConf.objectNameMap[layout.columns[i].dimension];
 
-						pt.viewport.colStore.add({
-							id: dim.dimensionName,
-							name: dimConf.objectNameMap[dim.dimensionName].name
-						});
+                        if (!Ext.Array.contains(dimNames, dim.dimensionName)) {
+                            pt.viewport.colStore.add({
+                                id: dim.dimensionName,
+                                name: dimConf.objectNameMap[dim.dimensionName].name
+                            });
+
+                            dimNames.push(dim.dimensionName);
+                        }
 
 						pt.viewport.dimensionStore.remove(pt.viewport.dimensionStore.getById(dim.dimensionName));
 					}
 				}
 
 				if (layout.rows) {
+                    dimNames = [];
+
 					for (var i = 0, dim; i < layout.rows.length; i++) {
 						dim = dimConf.objectNameMap[layout.rows[i].dimension];
 
-						pt.viewport.rowStore.add({
-							id: dim.dimensionName,
-							name: dimConf.objectNameMap[dim.dimensionName].name
-						});
+                        if (!Ext.Array.contains(dimNames, dim.dimensionName)) {
+                            pt.viewport.rowStore.add({
+                                id: dim.dimensionName,
+                                name: dimConf.objectNameMap[dim.dimensionName].name
+                            });
+
+                            dimNames.push(dim.dimensionName);
+                        }
 
 						pt.viewport.dimensionStore.remove(pt.viewport.dimensionStore.getById(dim.dimensionName));
 					}
 				}
 
 				if (layout.filters) {
+                    dimNames = [];
+
 					for (var i = 0, dim; i < layout.filters.length; i++) {
 						dim = dimConf.objectNameMap[layout.filters[i].dimension];
 
-						pt.viewport.filterStore.add({
-							id: dim.dimensionName,
-							name: dimConf.objectNameMap[dim.dimensionName].name
-						});
+                        if (!Ext.Array.contains(dimNames, dim.dimensionName)) {
+                            pt.viewport.filterStore.add({
+                                id: dim.dimensionName,
+                                name: dimConf.objectNameMap[dim.dimensionName].name
+                            });
+
+                            dimNames.push(dim.dimensionName);
+                        }
 
 						pt.viewport.dimensionStore.remove(pt.viewport.dimensionStore.getById(dim.dimensionName));
 					}