Skip to content

Commit 16fbb08

Browse files
Conditional formatting fixes, formatting zeros fix, etc
1 parent eafc872 commit 16fbb08

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "LightPivotTable",
33
"author": "ZitRo",
4-
"version": "1.7.0",
4+
"version": "1.7.1",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
77
"repository": {

source/js/DataController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ DataController.prototype.setData = function (data) {
107107
this.controller.pivotView.listingClickHandler.bind(this.controller.pivotView)
108108
);
109109
}
110-
//console.log(data);
110+
// console.log(data);
111111
this._trigger();
112112
return data;
113113

@@ -561,7 +561,7 @@ DataController.prototype.resetRawData = function () {
561561
rawData[y][x] = rd0[y][x-yw];
562562
} else {
563563
rawData[y][x] = {
564-
value: data.dataArray[(xw)*(y - xh) + x - yw] || ""
564+
value: data.dataArray[(xw)*(y - xh) + x - yw]
565565
};
566566
}
567567
}

source/js/PivotView.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,15 @@ PivotView.prototype.removeMessage = function () {
624624
};
625625

626626
/**
627-
* @param {*} value1
627+
* @param {*} value
628628
* @param {string} operator
629629
* @param {*} value2 - fixed value
630630
* @private
631631
* @return {boolean}
632632
*/
633-
PivotView.prototype._matchCondition = function (value1, operator, value2) {
633+
PivotView.prototype._matchCondition = function (value, operator, value2) {
634634

635+
var value1 = parseFloat(value);
635636
switch (operator) {
636637
case "=": return value1 == value2;
637638
case "<>": return value1 != value2;
@@ -1099,7 +1100,7 @@ PivotView.prototype.renderRawData = function (data) {
10991100

11001101
var formatContent = function (value, element, format) {
11011102
if (typeof(value) === 'string') { // not number, format as string
1102-
element.className += " formatLeft";
1103+
element.parentNode.className += " formatLeft";
11031104
element.innerHTML = (value || "").replace(/(https?|ftp):\/\/[^\s]+/ig, function linkReplace (p) {
11041105
return "<a href='" + p
11051106
+ "' target='" + (_.controller.CONFIG["linksTarget"] || "_blank")
@@ -1113,13 +1114,13 @@ PivotView.prototype.renderRawData = function (data) {
11131114
element.textContent = d.getHours() + d.getMinutes() + d.getSeconds() === 0
11141115
? d.toLocaleDateString() : d.toLocaleString();
11151116
} else if (format) { // set format
1116-
element.textContent = value ? _.numeral(value).format(format) : "";
1117+
element.textContent = value ? _.numeral(value).format(format) : value;
11171118
} else if (value) {
11181119
element.textContent = _.numeral(value).format(
11191120
value % 1 === 0 ? "#,###" : "#,###.##"
11201121
);
11211122
} else {
1122-
element.textContent = value || "";
1123+
element.textContent = value;
11231124
}
11241125
} else {
11251126
element.textContent = value;

0 commit comments

Comments
 (0)