← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19122: ER EV layout bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 19122 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-05-09 15:06:33 +0200
message:
  ER EV layout bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/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-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-05-08 19:21:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-05-09 13:05:23 +0000
@@ -1370,7 +1370,7 @@
         fixedFilterStore = getStore({name: 'fixedFilterStore'});
         filterStore = getStore({name: 'filterStore'});
         valueStore = getStore({name: 'valueStore'});
-nissa = rowStore;
+
         // store functions
         valueStore.addDefaultData = function() {
             if (!this.getById(defaultValueId)) {
@@ -1534,6 +1534,8 @@
 		});
 
         onValueSelect = function(id) {
+            id = id || value.getValue();
+
             if (id === defaultValueId) {
                 aggregationType.setDisabled();
             }
@@ -1735,12 +1737,17 @@
 			}
 		};
 
-		reset = function(isAll) {
+		reset = function(isAll, skipValueStore) {
 			colStore.removeAll();
 			rowStore.removeAll();
 			fixedFilterStore.removeAll();
 			filterStore.removeAll();
-            valueStore.removeAll();
+
+            if (!skipValueStore) {
+                valueStore.removeAll();
+                valueStore.addDefaultData();
+            }
+
             value.clearValue();
 
 			if (!isAll) {
@@ -1840,6 +1847,12 @@
 
                 return config;
             },
+            setValueConfig: function(valueId, aggType) {
+                value.setValue(valueId);
+                onValueSelect();
+
+                aggregationType.setValue(aggType);
+            },
             getOptions: function() {
                 return {
                     collapseDataDimensions: collapseDataDimensions.getValue()
@@ -4592,7 +4605,7 @@
             // favorite
 			if (layout && layout.dataType === 'aggregated_values') {
 
-                aggWindow.reset(true);
+                aggWindow.reset(true, true);
 
                 // start end dates
 				if (layout.startDate && layout.endDate) {
@@ -4633,6 +4646,11 @@
 					}
 				}
 
+                // value
+                if (layout.value && layout.aggregationType) {
+                    aggWindow.setValueConfig(layout.value.id, layout.aggregationType);
+                }
+
                 // collapse data dimensions
                 aggWindow.collapseDataDimensions.setValue(layout.collapseDataDimensions);
                 aggWindow.onCollapseDataDimensionsChange(layout.collapseDataDimensions);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-05-08 19:24:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-05-09 13:05:23 +0000
@@ -1568,6 +1568,8 @@
 		});
 
         onValueSelect = function(id) {
+            id = id || value.getValue();
+
             if (id === defaultValueId) {
                 aggregationType.setDisabled();
             }
@@ -1640,7 +1642,7 @@
         });
 
         onCollapseDataDimensionsChange = function(value) {
-            toggleDataItems(value);
+            //toggleDataItems(value);
             toggleValueGui(value);
         };
 
@@ -1700,7 +1702,7 @@
                 }
             }
 
-            //onCollapseDataDimensionsChange(collapseDataDimensions.getValue()); // not supported in EV yet
+            onCollapseDataDimensionsChange(collapseDataDimensions.getValue()); // not supported in EV yet
         };
 
         removeDimension = function(id, excludedStores) {
@@ -1769,12 +1771,17 @@
 			}
 		};
 
-		reset = function(isAll) {
+		reset = function(isAll, skipValueStore) {
 			colStore.removeAll();
 			rowStore.removeAll();
 			fixedFilterStore.removeAll();
 			filterStore.removeAll();
-            valueStore.removeAll();
+
+            if (!skipValueStore) {
+                valueStore.removeAll();
+                valueStore.addDefaultData();
+            }
+
             value.clearValue();
 
 			if (!isAll) {
@@ -1873,6 +1880,12 @@
 
                 return config;
             },
+            setValueConfig: function(valueId, aggType) {
+                value.setValue(valueId);
+                onValueSelect();
+
+                aggregationType.setValue(aggType);
+            },
             getOptions: function() {
                 return {
                     collapseDataDimensions: collapseDataDimensions.getValue()
@@ -4254,7 +4267,9 @@
 			}
 
             // favorite
-			if (layout && layout.dataType === 'aggregated_values') {
+			if (layout) {
+
+                aggWindow.reset(true, true);
 
                 // start end dates
 				if (layout.startDate && layout.endDate) {
@@ -4267,7 +4282,8 @@
                         dim = layout.columns[i];
                         record = recordMap[dim.dimension];
 
-						aggWindow.addDimension(record || extendDim(Ext.clone(dim)), aggWindow.colStore, null, true);
+						//aggWindow.addDimension(record || extendDim(Ext.clone(dim)), aggWindow.colStore, null, true);
+                        aggWindow.colStore.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 
@@ -4277,7 +4293,8 @@
                         dim = layout.rows[i];
                         record = recordMap[dim.dimension];
 
-						aggWindow.addDimension(record || extendDim(Ext.clone(dim)), aggWindow.rowStore, null, true);
+						//aggWindow.addDimension(record || extendDim(Ext.clone(dim)), aggWindow.rowStore, null, true);
+                        aggWindow.rowStore.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 
@@ -4288,10 +4305,16 @@
 						record = recordMap[dim.dimension];
 						store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.filterStore : aggWindow.fixedFilterStore;
 
-                        aggWindow.addDimension(record || extendDim(Ext.clone(dim)), store, null, true);
+                        //aggWindow.addDimension(record || extendDim(Ext.clone(dim)), store, null, true);
+                        store.add(record || extendDim(Ext.clone(dim)));
 					}
 				}
 
+                // value
+                if (layout.value && layout.aggregationType) {
+                    aggWindow.setValueConfig(layout.value.id, layout.aggregationType);
+                }
+
                 // collapse data dimensions
                 aggWindow.collapseDataDimensions.setValue(layout.collapseDataDimensions);
                 aggWindow.onCollapseDataDimensionsChange(layout.collapseDataDimensions);