Skip to content

Commit 9b50761

Browse files
hotfix for complex and custom columns hierarchy
1 parent 13b3a09 commit 9b50761

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

export/LightPivotTable.xml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<Class name="DeepSee.LightPivotTable">
1313
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
14-
<TimeChanged>63524,83748.41729</TimeChanged>
14+
<TimeChanged>63531,76537.988508</TimeChanged>
1515
<TimeCreated>63515,61322.546099</TimeCreated>
1616

1717
<Parameter name="INCLUDEFILES">
@@ -175,28 +175,15 @@
175175
setup = {
176176
container: container,
177177
dataSource: {
178+
pivot: info["dataSource"],
178179
MDX2JSONSource: source,
179180
basicMDX: info["mdx"]
180181
}
181182
}
182183
if (info["drillDownDataSource"]) setup["drillDownTarget"] = info["drillDownDataSource"];
183184
setup["showSummary"] = !!parseInt(container.getAttribute("show-summary"));
184185
185-
post(source + "/DataSource", { DataSource: info["dataSource"] }, function (data) {
186-
187-
//console.log(data);
188-
if (data["rowAxisOptions"]) {
189-
if (data["rowAxisOptions"]["drilldownSpec"]) {
190-
setup.DrillDownExpression = data["rowAxisOptions"]["drilldownSpec"].split("^");
191-
}
192-
if (data["rowAxisOptions"]["levelFormat"] || data["columnAxisOptions"] && data["columnAxisOptions"]["levelFormat"]) {
193-
setup["formatNumbers"] = data["columnAxisOptions"]["levelFormat"] || data["rowAxisOptions"]["levelFormat"];
194-
}
195-
}
196-
197-
_.LightPivotTable = new LightPivotTable(setup);
198-
199-
});
186+
_.LightPivotTable = new LightPivotTable(setup);
200187
}
201188
});
202189

source/js/DataController.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,18 @@ DataController.prototype.setData = function (data) {
9292

9393
};
9494

95+
/**
96+
* Renders table data (pseudo-table object) from data retrieved from MDX2JSON source.
97+
*
98+
* @returns {Object}
99+
*/
95100
DataController.prototype.resetRawData = function () {
96101

97102
var data, summary, y, x;
98103

99104
if (!(data = this._dataStack[this._dataStack.length - 1].data)) {
100105
console.error("Unable to create raw data for given data set.");
101-
return;
106+
return null;
102107
}
103108

104109
var rd0 = [], rd1 = [], groupNum = 2, rawData = [];
@@ -114,6 +119,14 @@ DataController.prototype.resetRawData = function () {
114119
var dim0raw = function (a, c, arr) {
115120

116121
dim1raw(rd0, c, arr);
122+
123+
// @hotfix https://github.com/intersystems-ru/Cache-MDX2JSON/issues/29
124+
var i, maxLen = 0;
125+
for (i in rd0) { if (rd0[i].length > maxLen) maxLen = rd0[i].length; }
126+
for (i in rd0) { for (var u = rd0[i].length; u < maxLen; u++) {
127+
rd0[i].push(rd0[i][rd0[i].length - 1]);
128+
}}
129+
117130
rd0 = transpose(rd0);
118131

119132
};
@@ -152,6 +165,8 @@ DataController.prototype.resetRawData = function () {
152165
if (data.dimensions[0].length) dim0raw(rd0, data.dimensions[0]);
153166
if (data.dimensions[1].length) dim1raw(rd1, data.dimensions[1]);
154167

168+
console.log(rd0, rd1);
169+
155170
var xw = (rd0[0] || []).length,
156171
yh = rd1.length || data.info.rowCount || 0,
157172
xh = rd0.length || data.info.colCount || 0,

0 commit comments

Comments
 (0)