← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16481: ER gui behaviour fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16481 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-22 15:30:10 +0200
message:
  ER gui behaviour fix.
modified:
  dhis-2/dhis-web/dhis-web-apps/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-apps/src/main/webapp/dhis-web-event-reports/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-08-19 09:20:11 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-08-22 12:51:01 +0000
@@ -3381,7 +3381,7 @@
 			stage.clearValue();
 
 			dataElementsByStageStore.removeAll();
-			dataElementSelected.removeAll();
+			dataElementSelected.removeAllDataElements(true);
 
             load = function(stages) {
                 stage.enable();
@@ -3390,9 +3390,6 @@
                 stagesByProgramStore.removeAll();
                 stagesByProgramStore.loadData(stages);
 
-                ns.app.aggregateLayoutWindow.resetData();
-				ns.app.queryLayoutWindow.resetData();
-
                 stageId = (layout ? layout.programStage.id : null) || (stages.length === 1 ? stages[0].id : null);
 
                 if (stageId) {
@@ -3468,9 +3465,7 @@
 
 		onStageSelect = function(stageId, layout) {
             if (!layout) {
-                dataElementSelected.removeAll();
-                ns.app.aggregateLayoutWindow.resetData();
-                ns.app.queryLayoutWindow.resetData();
+                dataElementSelected.removeAllDataElements(true);
             }
 
 			loadDataElements(stageId, layout);
@@ -3626,12 +3621,12 @@
 
 				return hasDataElement;
 			},
-			removeAllDataElements: function() {
+			removeAllDataElements: function(reset) {
 				var items = this.items.items,
 					len = items.length;
 
 				for (var i = 0; i < len; i++) {
-					items[0].removeDataElement();
+					items[0].removeDataElement(reset);
 				}
 			}
         });
@@ -3669,12 +3664,14 @@
 				dataElement: element
 			}));
 
-			ux.removeDataElement = function() {
+			ux.removeDataElement = function(reset) {
 				dataElementSelected.remove(ux);
 
 				if (!dataElementSelected.hasDataElement(element.id)) {
-					dataElementsByStageStore.add(element);
-					dataElementsByStageStore.sort();
+                    if (!reset) {
+                        dataElementsByStageStore.add(element);
+                        dataElementsByStageStore.sort();
+                    }
 
                     ns.app.aggregateLayoutWindow.removeDimension(element.id);
                     ns.app.queryLayoutWindow.removeDimension(element.id);