Merge authors:
  Jan Henrik Ă˜verland (janhenrik-overland)
------------------------------------------------------------
revno: 13131 [merge]
committer: Jan Henrik Overland <janhenrik.overl...@gmail.com>
branch nick: dhis2
timestamp: Tue 2013-12-03 18:29:17 +0100
message:
  (PT) Sorting on row totals implemented.
modified:
  
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/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-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-12-02 16:45:04 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-12-03 16:59:29 +0000
@@ -2313,15 +2313,6 @@
 					web.storage.session.set(layout, 'table');
 				}
 
-
-
-							//valueEl.dom.onValueMouseClick = web.events.onValueMouseClick;
-							//valueEl.dom.layout = layout;
-							//valueEl.dom.response = response;
-							//valueEl.dom.uuidDimUuidsMap = uuidDimUuidsMap;
-							//valueEl.dom.uuidObjectMap = uuidObjectMap;
-							//valueEl.dom.setAttribute('onclick', 'this.onValueMouseClick(this.layout, this.response, this.uuidDimUuidsMap, this.uuidObjectMap, this.id);');
-
 				ns.app.viewport.setGui(layout, xLayout, isUpdateGui);
 
 				web.mask.hide(ns.app.centerRegion);

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-12-03 11:12:47 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-12-03 17:05:57 +0000
@@ -1902,7 +1902,7 @@
 							dimHtml.push(getEmptyHtmlArray());
 						}
 
-						for (var j = 0, obj, spanCount = 0, condoId; j < xColAxis.size; j++) {
+						for (var j = 0, obj, spanCount = 0, condoId, totalId; j < xColAxis.size; j++) {
 							spanCount++;
 
 							obj = xColAxis.objects.all[i][j];
@@ -1931,12 +1931,15 @@
 							}
 
 							if (i === 0 && (j === xColAxis.size - 1) && doTotals()) {
+								totalId = doSortableColumnHeaders() ? 'total_' : null;
+
 								dimHtml.push(getTdHtml({
+									uuid: Ext.data.IdGenerator.get('uuid').generate(),
 									type: 'dimensionTotal',
 									cls: 'pivot-dim-total',
 									rowSpan: xColAxis.dims,
 									htmlValue: 'Total'
-								}));
+								}, totalId));
 							}
 						}
 
@@ -2057,6 +2060,7 @@
 								total += obj.value;
 							}
 
+							// row totals
 							totalValueObjects.push({
 								type: 'valueTotal',
 								cls: 'pivot-value-total',
@@ -2065,6 +2069,14 @@
 								empty: !Ext.Array.contains(empty, false)
 							});
 
+							// add row totals to idValueMap to make sorting on totals possible
+							if (doSortableColumnHeaders()) {
+								var totalId = 'total_' + xRowAxis.ids[i],
+									isEmpty = !Ext.Array.contains(empty, false);
+
+								xResponse.idValueMap[totalId] = isEmpty ? null : total;
+							}
+
 							empty = [];
 							total = 0;
 						}
@@ -2299,6 +2311,7 @@
 								empty.push(!!obj.empty);
 							}
 
+							// col total
 							totalColObjects.push({
 								type: 'valueTotal',
 								value: total,

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to