Skip to content

Commit

Permalink
Conditional formatting fixes, formatting zeros fix, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Nov 6, 2016
1 parent eafc872 commit 16fbb08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LightPivotTable",
"author": "ZitRo",
"version": "1.7.0",
"version": "1.7.1",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions source/js/DataController.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ DataController.prototype.setData = function (data) {
this.controller.pivotView.listingClickHandler.bind(this.controller.pivotView)
);
}
//console.log(data);
// console.log(data);
this._trigger();
return data;

Expand Down Expand Up @@ -561,7 +561,7 @@ DataController.prototype.resetRawData = function () {
rawData[y][x] = rd0[y][x-yw];
} else {
rawData[y][x] = {
value: data.dataArray[(xw)*(y - xh) + x - yw] || ""
value: data.dataArray[(xw)*(y - xh) + x - yw]
};
}
}
Expand Down
11 changes: 6 additions & 5 deletions source/js/PivotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,14 +624,15 @@ PivotView.prototype.removeMessage = function () {
};

/**
* @param {*} value1
* @param {*} value
* @param {string} operator
* @param {*} value2 - fixed value
* @private
* @return {boolean}
*/
PivotView.prototype._matchCondition = function (value1, operator, value2) {
PivotView.prototype._matchCondition = function (value, operator, value2) {

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

var formatContent = function (value, element, format) {
if (typeof(value) === 'string') { // not number, format as string
element.className += " formatLeft";
element.parentNode.className += " formatLeft";
element.innerHTML = (value || "").replace(/(https?|ftp):\/\/[^\s]+/ig, function linkReplace (p) {
return "<a href='" + p
+ "' target='" + (_.controller.CONFIG["linksTarget"] || "_blank")
Expand All @@ -1113,13 +1114,13 @@ PivotView.prototype.renderRawData = function (data) {
element.textContent = d.getHours() + d.getMinutes() + d.getSeconds() === 0
? d.toLocaleDateString() : d.toLocaleString();
} else if (format) { // set format
element.textContent = value ? _.numeral(value).format(format) : "";
element.textContent = value ? _.numeral(value).format(format) : value;
} else if (value) {
element.textContent = _.numeral(value).format(
value % 1 === 0 ? "#,###" : "#,###.##"
);
} else {
element.textContent = value || "";
element.textContent = value;
}
} else {
element.textContent = value;
Expand Down

0 comments on commit 16fbb08

Please sign in to comment.