← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16061: ER restore favorite issue fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16061 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-09 21:29:35 +0200
message:
  ER restore favorite issue fixed.
modified:
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/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-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-07-08 14:37:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-07-09 19:28:50 +0000
@@ -3297,6 +3297,24 @@
 				treePanel.reset();
 			}
 
+            // dimensions
+			for (var key in dimensionIdSelectedStoreMap) {
+				if (dimensionIdSelectedStoreMap.hasOwnProperty(key)) {
+					var a = dimensionIdAvailableStoreMap[key],
+						s = dimensionIdSelectedStoreMap[key];
+
+					if (s.getCount() > 0) {
+						a.reset();
+						s.removeAll();
+					}
+
+					if (recMap[key]) {
+						s.add(recMap[key]);
+						ns.core.web.multiSelect.filterAvailable({store: a}, {store: s});
+					}
+				}
+			}
+
 			// options
 			if (optionsWindow) {
 				optionsWindow.setOptions(layout);
@@ -3654,6 +3672,7 @@
         selectDataElements = function(items, layout) {
             var dataElements = [],
 				allElements = [],
+                fixedFilterElementIds = [],
                 aggWindow = ns.app.aggregateLayoutWindow,
                 queryWindow = ns.app.queryLayoutWindow,
                 includeKeys = ['int', 'number', 'boolean', 'bool'],
@@ -3661,9 +3680,13 @@
                 recordMap = {
 					'pe': {id: 'pe', name: 'Periods'},
 					'ou': {id: 'ou', name: 'Organisation units'}
-				};
+				},
+                extendDim = function(dim) {
+                    dim.id = dim.id || dim.dimension;
+                    dim.name = dim.name || ns.app.response.metaData.names[dim.dimension] || "Nissa";
 
-                fixedFilterElementIds = [];
+                    return dim;
+                };
 
 			// data element objects
             for (var i = 0, item; i < items.length; i++) {
@@ -3737,23 +3760,30 @@
 				}
 
 				if (layout.columns) {
-					for (var i = 0; i < layout.columns.length; i++) {
-						aggWindow.colStore.add(recordMap[layout.columns[i].dimension]);
+					for (var i = 0, record, dim; i < layout.columns.length; i++) {
+                        dim = layout.columns[i];
+                        record = recordMap[dim.dimension];
+
+						aggWindow.colStore.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 
 				if (layout.rows) {
-					for (var i = 0; i < layout.rows.length; i++) {
-						aggWindow.rowStore.add(recordMap[layout.rows[i].dimension]);
+					for (var i = 0, record, dim; i < layout.rows.length; i++) {
+                        dim = layout.rows[i];
+                        record = recordMap[dim.dimension];
+
+						aggWindow.rowStore.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 
 				if (layout.filters) {
-					for (var i = 0, store, record; i < layout.filters.length; i++) {
-						record = recordMap[layout.filters[i].dimension];
+					for (var i = 0, store, record, dim; i < layout.filters.length; i++) {
+                        dim = layout.filters[i];
+						record = recordMap[dim.dimension];
 						store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.filterStore : aggWindow.fixedFilterStore;
 
-						store.add(record);
+						store.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 			}
@@ -4959,7 +4989,7 @@
                 var win = ns.app.viewport.getLayoutWindow();
 
                 if (selectedStore.getRange().length) {
-                    win.addDimension({id: dimension.id, name: dimension.name});
+                    win.addDimension({id: dimension.id, name: dimension.name}, win.rowStore);
                 }
                 else if (!selectedStore.getRange().length && win.hasDimension(dimension.id)) {
                     win.removeDimension(dimension.id);