Skip to content

Commit

Permalink
custom DrillDown on higher levels support
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Dec 3, 2014
1 parent 874e388 commit a17c0b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 2 additions & 3 deletions export/LightPivotTable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<Class name="DeepSee.LightPivotTable">
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
<TimeChanged>63524,69651.14693</TimeChanged>
<TimeChanged>63524,83748.41729</TimeChanged>
<TimeCreated>63515,61322.546099</TimeCreated>

<Parameter name="INCLUDEFILES">
Expand Down Expand Up @@ -187,8 +187,7 @@
//console.log(data);
if (data["rowAxisOptions"]) {
if (data["rowAxisOptions"]["drilldownSpec"]) {
console.log(data["rowAxisOptions"]["drilldownSpec"]);
setup.DrillDownExpression = data["rowAxisOptions"]["drilldownSpec"];
setup.DrillDownExpression = data["rowAxisOptions"]["drilldownSpec"].split("^");
}
if (data["rowAxisOptions"]["levelFormat"] || data["columnAxisOptions"] && data["columnAxisOptions"]["levelFormat"]) {
setup["formatNumbers"] = data["columnAxisOptions"]["levelFormat"] || data["rowAxisOptions"]["levelFormat"];
Expand Down
11 changes: 9 additions & 2 deletions source/js/LightPivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var LightPivotTable = function (configuration) {

this._dataSourcesStack = [];

this.DRILL_LEVEL = -1;
this.CONFIG = configuration;

this.mdxParser = new MDXParser();
Expand Down Expand Up @@ -84,6 +85,7 @@ LightPivotTable.prototype.pushDataSource = function (config) {

var newDataSource;

this.DRILL_LEVEL++;
this._dataSourcesStack.push(newDataSource = new DataSource(config));
this.dataSource = newDataSource;

Expand All @@ -95,6 +97,7 @@ LightPivotTable.prototype.popDataSource = function () {

if (this._dataSourcesStack.length < 2) return;

this.DRILL_LEVEL--;
this._dataSourcesStack.pop();
this.dataController.popData();

Expand Down Expand Up @@ -125,9 +128,13 @@ LightPivotTable.prototype.tryDrillDown = function (filter) {
// clone dataSource config object
for (var i in _.CONFIG.dataSource) { ds[i] = _.CONFIG.dataSource[i]; }

if (this.CONFIG.DrillDownExpression && this._dataSourcesStack.length < 2) {
if (this.CONFIG.DrillDownExpression && !(this.CONFIG.DrillDownExpression instanceof Array)) {
this.CONFIG.DrillDownExpression = [this.CONFIG.DrillDownExpression];
}

if ((this.CONFIG.DrillDownExpression || [])[this.DRILL_LEVEL]) {
ds.basicMDX = this.mdxParser.drillDown(
this.dataSource.BASIC_MDX, filter, this.CONFIG.DrillDownExpression
this.dataSource.BASIC_MDX, filter, this.CONFIG.DrillDownExpression[this.DRILL_LEVEL]
) || this.dataSource.BASIC_MDX;
} else {
ds.basicMDX = this.mdxParser.drillDown(this.dataSource.BASIC_MDX, filter) || this.dataSource.BASIC_MDX;
Expand Down
2 changes: 1 addition & 1 deletion source/js/PivotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ PivotView.prototype.renderRawData = function (data) {
td.className = "formatLeft";
}
if (data[y][x].style) {
for (i in data[y][x].style) {
for (var i in data[y][x].style) {
td.style[i] = data[y][x].style[i];
}
}
Expand Down

0 comments on commit a17c0b5

Please sign in to comment.