Skip to content

Commit 5e9b916

Browse files
column & row pivot styles, standard CSS formatting for header
1 parent 4e7fe3e commit 5e9b916

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

source/css/LightPivot.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
height: 14px;
2727
top: 1px;
2828
padding: 2px;
29-
vertical-align: middle;
29+
vertical-align: bottom;
3030
display: inline-block;
3131
position: relative;
3232
}
@@ -71,12 +71,13 @@
7171
.lpt table tr:first-child th:first-child {
7272
position: relative;
7373
white-space: nowrap;
74+
vertical-align: bottom;
7475
}
7576

7677
.lpt .drillDownIcon {
7778
position: relative;
7879
display: inline-block;
79-
vertical-align: middle;
80+
vertical-align: bottom;
8081
width: 15px;
8182
height: 14px;
8283
border: 2px solid #000000;

source/js/DataController.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ DataController.prototype.resetRawData = function () {
119119

120120
var dim0raw = function (a, c, arr) {
121121

122-
dim1raw(rd0, c, arr);
122+
dim1raw(rd0, c, arr, true);
123123

124124
// @hotfix https://github.com/intersystems-ru/Cache-MDX2JSON/issues/29
125125
var i, maxLen = 0;
@@ -132,31 +132,44 @@ DataController.prototype.resetRawData = function () {
132132

133133
};
134134

135-
var dim1raw = function (a, c, arr) {
135+
var applyHeaderStyle = function (cellObject, isHorizontal) {
136+
if (!_.controller.CONFIG["pivotProperties"]) return;
137+
if (_.controller.CONFIG["pivotProperties"]["columnHeaderStyle"] && isHorizontal) {
138+
cellObject.style = _.controller.CONFIG["pivotProperties"]["columnHeaderStyle"];
139+
} else if (_.controller.CONFIG["pivotProperties"]["rowHeaderStyle"] && !isHorizontal) {
140+
cellObject.style = _.controller.CONFIG["pivotProperties"]["rowHeaderStyle"];
141+
}
142+
};
143+
144+
var dim1raw = function (a, c, arr, hor) {
136145

137146
if (!arr) {
138147
arr = [];
139148
}
140149

141-
var cnum;
150+
var cnum, obj;
142151

143152
for (var i in c) {
144153
cnum = groupNum;
145154
if (c[i].children) {
146155
groupNum++;
147-
dim1raw(a, c[i].children, arr.concat({
156+
obj = {
148157
group: cnum,
149158
source: c[i],
150159
isCaption: true,
151160
value: c[i].caption || ""
152-
}));
161+
};
162+
applyHeaderStyle(obj, hor);
163+
dim1raw(a, c[i].children, arr.concat(obj), hor);
153164
} else {
154-
a.push(arr.concat({
165+
obj = {
155166
group: groupNum,
156167
source: c[i],
157168
isCaption: true,
158169
value: c[i].caption || ""
159-
}));
170+
};
171+
applyHeaderStyle(obj, hor);
172+
a.push(arr.concat(obj));
160173
groupNum++;
161174
}
162175
}

0 commit comments

Comments
 (0)