dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31543
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16085: ER query issue fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16085 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-07-11 14:30:18 +0200
message:
ER query issue fixed.
modified:
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/core.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-09 19:28:50 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js 2014-07-11 12:29:08 +0000
@@ -1275,6 +1275,7 @@
getSetup,
addDimension,
removeDimension,
+ hasDimension,
saveState,
resetData,
reset,
@@ -1423,9 +1424,12 @@
};
};
- addDimension = function(record) {
- var store = dimensionStoreMap[record.id] || dimensionStore;
- store.add(record);
+ addDimension = function(record, store) {
+ var store = dimensionStoreMap[record.id] || store || dimensionStore;
+
+ if (!hasDimension(record.id)) {
+ store.add(record);
+ }
};
removeDimension = function(dataElementId) {
@@ -1442,6 +1446,21 @@
}
};
+ hasDimension = function(id) {
+ var stores = [colStore, dimensionStore];
+
+ for (var i = 0, store, index; i < stores.length; i++) {
+ store = stores[i];
+ index = store.findExact('id', id);
+
+ if (index != -1) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
saveState = function(map) {
map = map || dimensionStoreMap;
@@ -1492,6 +1511,7 @@
colStore: colStore,
addDimension: addDimension,
removeDimension: removeDimension,
+ hasDimension: hasDimension,
saveState: saveState,
resetData: resetData,
reset: reset,
@@ -2433,10 +2453,12 @@
params: Ext.encode(favorite),
success: function(r) {
ns.app.layout.id = record.data.id;
- ns.app.xLayout.id = record.data.id;
-
ns.app.layout.name = true;
- ns.app.xLayout.name = true;
+
+ if (ns.app.xLayout) {
+ ns.app.xLayout.id = record.data.id;
+ ns.app.xLayout.name = true;
+ }
ns.app.stores.eventReport.loadStore();
}
@@ -3683,7 +3705,7 @@
},
extendDim = function(dim) {
dim.id = dim.id || dim.dimension;
- dim.name = dim.name || ns.app.response.metaData.names[dim.dimension] || "Nissa";
+ dim.name = dim.name || ns.app.response.metaData.names[dim.dimension];
return dim;
};
@@ -4986,13 +5008,18 @@
getPanels;
onSelect = function() {
- var win = ns.app.viewport.getLayoutWindow();
+ var aggWin = ns.app.aggregateLayoutWindow,
+ queryWin = ns.app.queryLayoutWindow;
if (selectedStore.getRange().length) {
- win.addDimension({id: dimension.id, name: dimension.name}, win.rowStore);
- }
- else if (!selectedStore.getRange().length && win.hasDimension(dimension.id)) {
- win.removeDimension(dimension.id);
+ aggWin.addDimension({id: dimension.id, name: dimension.name}, aggWin.rowStore);
+ queryWin.addDimension({id: dimension.id, name: dimension.name}, queryWin.colStore);
+ }
+ else if (!selectedStore.getRange().length && aggWin.hasDimension(dimension.id)) {
+ aggWin.removeDimension(dimension.id);
+ }
+ else if (!selectedStore.getRange().length && queryWin.hasDimension(dimension.id)) {
+ queryWin.removeDimension(dimension.id);
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.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/core.js 2014-07-11 12:29:08 +0000
@@ -2784,6 +2784,7 @@
web.report.query.getHtml = function(layout, xResponse) {
var dimensionHeaders = xResponse.dimensionHeaders,
rows = xResponse.rows,
+ names = xResponse.metaData.names,
tableCls = 'pivot',
html = '';
@@ -2817,6 +2818,7 @@
for (var j = 0, str, header, name; j < dimensionHeaders.length; j++) {
header = dimensionHeaders[j];
str = row[header.index];
+ str = names.hasOwnProperty(str) ? names[str] : str;
name = web.report.query.format(str);
//if (header.name === 'ouname' && layout.showHierarchy) {