← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10385: (PT) Hide empty rows issues fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 10385 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-21 15:41:46 +0100
message:
  (PT) Hide empty rows issues fixed.
modified:
  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/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-03-20 16:18:05 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-03-21 14:38:57 +0000
@@ -838,14 +838,18 @@
 
 	//nCols			= 12
 
-
 				for (var i = 0; i < aUniqueIds.length; i++) {
 					if (aNumCols[i] === 1) {
 						if (i === 0) {
-							aSpan.push(nCols); //if just one and top level, span all
+							aSpan.push(nCols); //if just one item and top level, span all
 						}
 						else {
-							aSpan.push(aSpan[0]); //if just one and not top level, span same as top level
+							if (options.hideEmptyRows && type === 'row') {	
+								aSpan.push(nCols / aAccNumCols[i]);
+							}
+							else {
+								aSpan.push(aSpan[0]); //if just one item and not top level, span same as top level
+							}
 						}
 					}
 					else {
@@ -924,12 +928,16 @@
 					aAllObjects.push(allRow);
 				}
 
-				// add span
+				// add span and children
 				for (var i = 0; i < aAllObjects.length; i++) {
 					for (var j = 0, obj; j < aAllObjects[i].length; j += aSpan[i]) {
 						obj = aAllObjects[i][j];
+
+						// span
 						obj[spanType] = aSpan[i];
-						obj.children = aSpan[i] === 1 ? 0 : aSpan[i];
+
+						// children
+						obj.children = Ext.isDefined(aSpan[i + 1]) ? aSpan[i] / aSpan[i + 1] : 0;
 
 						if (i === 0) {
 							obj.root = true;
@@ -1143,8 +1151,7 @@
 							obj.collapsed = true;
 
 							if (obj.parent) {
-								obj.parent.children--;
-								obj.parent.rowSpan = obj.parent.parent ? obj.parent.rowSpan-- : obj.parent.rowSpan;
+								obj.parent.children = obj.parent.children - 1;
 							}
 						}
 
@@ -1311,7 +1318,7 @@
 								obj = {};
 								obj.type = 'dimensionSubtotal';
 								obj.cls = 'pivot-dim-subtotal';
-								obj.collapsed = !Ext.Array.contains(collapsed, false);
+								obj.hidden = Ext.Array.contains(collapsed, true);
 
 								if (i === 0) {
 									obj.htmlValue = '&nbsp;'; //i18n