Skip to content

Commit 4a87491

Browse files
changeBasicMDX fixes
1 parent f92f3f4 commit 4a87491

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ lp.setFilter("[DateOfSale].[Actual].[YearSold].&[2009]");
7575

7676
lp.refresh(); // refresh pivot contents
7777
lp.updateSizes(); // recalculate pivot sizes
78-
lp.changeBasicMDX("..."); // change basic mdx
79-
lp.getActualMDX(); // get the current mdx
78+
lp.changeBasicMDX("..."); // change mdx for LPT
8079
```
8180

8281
#### Caché DeepSee

source/js/DataSource.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ var DataSource = function (config, globalConfig, lpt) {
1818
this.LPT = lpt;
1919
this.GLOBAL_CONFIG = globalConfig;
2020

21+
this.BASIC_MDX = config.basicMDX;
22+
2123
/**
2224
* Name of data source pivot.
2325
*
@@ -121,7 +123,7 @@ DataSource.prototype.getCurrentData = function (callback) {
121123

122124
var _ = this,
123125
__ = this._convert,
124-
mdx = this.LPT.CONFIG.dataSource["basicMDX"],
126+
mdx = this.BASIC_MDX,
125127
mdxParser = new MDXParser(),
126128
mdxType = mdxParser.mdxType(mdx),
127129
ready = {

source/js/LightPivotTable.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,24 @@ LightPivotTable.prototype.refresh = function () {
7272
*/
7373
LightPivotTable.prototype.changeBasicMDX = function (mdx) {
7474

75+
// return LPT to the first level
76+
for (var i = this._dataSourcesStack.length - 1; i > 0; i--) {
77+
this.popDataSource();
78+
this.pivotView.popTable();
79+
this.dataController.popData();
80+
}
81+
// change MDX
7582
this.CONFIG.dataSource.basicMDX = mdx;
83+
this.dataSource.BASIC_MDX = mdx;
84+
// do refresh
7685
this.refresh();
7786

7887
};
7988

8089
/**
8190
* Returns current mdx including filters.
8291
* @returns {string}
92+
* @deprecated
8393
*/
8494
LightPivotTable.prototype.getActualMDX = function () {
8595

0 commit comments

Comments
 (0)