Skip to content

Commit d67db5a

Browse files
Apply header styles defined in header
1 parent 65386b5 commit d67db5a

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-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.8.8",
4+
"version": "1.8.9",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
77
"repository": {

source/js/DataController.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,22 @@ DataController.prototype.resetRawData = function () {
434434

435435
};
436436

437-
var applyHeaderStyle = function (cellObject, isHorizontal) {
437+
var applyHeaderStyle = function (cellObject, isHorizontal, previousHeaders) {
438438
if (!_.controller.CONFIG["pivotProperties"]) return;
439439
if (_.controller.CONFIG["pivotProperties"]["columnHeaderStyle"] && isHorizontal) {
440-
cellObject.style = _.controller.CONFIG["pivotProperties"]["columnHeaderStyle"];
440+
cellObject.style =
441+
_.controller.CONFIG["pivotProperties"]["columnHeaderStyle"] + cellObject.style;
441442
} else if (_.controller.CONFIG["pivotProperties"]["rowHeaderStyle"] && !isHorizontal) {
442-
cellObject.style = _.controller.CONFIG["pivotProperties"]["rowHeaderStyle"];
443+
cellObject.style =
444+
_.controller.CONFIG["pivotProperties"]["rowHeaderStyle"] + cellObject.style;
443445
}
446+
if (typeof previousHeaders === "undefined")
447+
return;
448+
var prevStyles = previousHeaders.reduce(
449+
function (acc, h) { return acc + (h.style || "") }, ""
450+
);
451+
if (prevStyles)
452+
cellObject.style += prevStyles;
444453
};
445454

446455
var getMaxLevel = function (children, level) {
@@ -489,18 +498,20 @@ DataController.prototype.resetRawData = function () {
489498
group: cnum,
490499
source: c[i],
491500
isCaption: true,
492-
value: c[i].caption || ""
501+
value: c[i].caption || "",
502+
style: c[i].style || ""
493503
};
494-
applyHeaderStyle(obj, hor);
504+
applyHeaderStyle(obj, hor, arr);
495505
dim1raw(a, c[i].children, arr.concat(obj), hor, level? level + 1 : level, maxLevel);
496506
} else {
497507
obj = {
498508
group: groupNum,
499509
source: c[i],
500510
isCaption: true,
501-
value: c[i].caption || ""
511+
value: c[i].caption || "",
512+
style: c[i].style || ""
502513
};
503-
applyHeaderStyle(obj, hor);
514+
applyHeaderStyle(obj, hor, arr);
504515
a.push(c[i]["type"] === "msr" && MEASURES_HIDDEN ? arr : arr.concat(obj));
505516
groupNum++;
506517
}

0 commit comments

Comments
 (0)