← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20965: PT noext.

 

------------------------------------------------------------
revno: 20965
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-11-05 16:39:35 +0100
message:
  PT noext.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.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-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-10-26 15:34:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-11-05 15:39:35 +0000
@@ -862,7 +862,7 @@
 			support.prototype.number.prettyPrint = function(number, separator) {
 				separator = separator || conf.finals.style.space;
 
-				if (separator === conf.finals.style.space.none) {
+				if (separator === conf.finals.style.none) {
 					return number;
 				}
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-04 15:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-05 15:39:35 +0000
@@ -1442,6 +1442,9 @@
         //todo Table
         (function() {
             var Table = NS.Api.Table = function(layout, response, colAxis, rowAxis) {
+                var t = this;
+
+                // init
 				var getRoundedHtmlValue,
 					getTdHtml,
 					doSubTotals,
@@ -1479,9 +1482,11 @@
 					//isLegendSet = NS.isObject(xLayout.legendSet) && NS.isArray(xLayout.legendSet.legends) && xLayout.legendSet.legends.length,
 					isLegendSet = false,
                     tdCount = 0,
-                    htmlArray;
+                    htmlArray,
+                    dimConf = NS.conf.finals.dimension,
+                    styleConf = NS.conf.finals.style;
 
-				xResponse.sortableIdObjects = [];
+				response.sortableIdObjects = []; //todo
 
 				getRoundedHtmlValue = function(value, dec) {
 					dec = dec || 2;
@@ -1552,7 +1557,7 @@
 					colSpan = config.colSpan ? 'colspan="' + config.colSpan + '" ' : '';
 					rowSpan = config.rowSpan ? 'rowspan="' + config.rowSpan + '" ' : '';
                     htmlValue = getHtmlValue(config);
-					htmlValue = config.type !== 'dimension' ? support.prototype.number.prettyPrint(htmlValue, layout.digitGroupSeparator) : htmlValue;
+					htmlValue = config.type !== 'dimension' ? t.prettyPrint(htmlValue, layout.digitGroupSeparator) : htmlValue;
 
 					cls += config.hidden ? ' td-hidden' : '';
 					cls += config.collapsed ? ' td-collapsed' : '';
@@ -1564,7 +1569,7 @@
 					if (NS.isString(metaDataId)) {
 						cls += ' td-sortable';
 
-						xResponse.sortableIdObjects.push({
+						response.sortableIdObjects.push({
 							id: metaDataId,
 							uuid: config.uuid
 						});
@@ -2245,17 +2250,26 @@
 				};
 
 				// get html
-				return function() {
-					htmlArray = NS.arrayClean([].concat(getColAxisHtmlArray() || [], getRowHtmlArray() || [], getTotalHtmlArray() || []));
-
-					return {
-						html: getHtml(htmlArray),
-						uuidDimUuidsMap: uuidDimUuidsMap,
-						colAxis: colAxis,
-						rowAxis: rowAxis,
-                        tdCount: tdCount
-					};
-				}();
+                htmlArray = NS.arrayClean([].concat(getColAxisHtmlArray() || [], getRowHtmlArray() || [], getTotalHtmlArray() || []));
+
+                // constructor
+                t.html = getHtml(htmlArray);
+                t.uuidDimUuidsMap = uuidDimUuidsMap;
+                t.colAxis = colAxis;
+                t.rowAxis = rowAxis;
+                t.tdCount = tdCount;
+			};
+
+            Table.prototype.prettyPrint = function(number, separator) {
+                var styleConf = NS.conf.finals.style;
+
+				separator = separator || styleConf.space;
+
+				if (separator === styleConf.none) {
+					return number;
+				}
+
+				return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, NS.conf.style.digitGroupSeparator[separator]);
 			};
         })();
     })();