Skip to content

Commit f3d72e2

Browse files
changing MDX option, parsing errors step 2
1 parent ef24865 commit f3d72e2

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +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
7879
```
7980

8081
#### Caché DeepSee

source/js/DataSource.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var DataSource = function (config, globalConfig, lpt) {
1515
this.NAMESPACE = config["namespace"];
1616
this.USERNAME = config["username"];
1717
this.PASSWORD = config["password"];
18-
this.BASIC_MDX = config.basicMDX;
1918
this.LPT = lpt;
2019
this.GLOBAL_CONFIG = globalConfig;
2120

@@ -47,10 +46,16 @@ DataSource.prototype._post = function (url, data, callback) {
4746
try {
4847
return JSON.parse(xhr.responseText) || {}
4948
} catch (e) {
50-
return {
51-
error: "<h1>Unable to parse server response</h1><p>" + xhr.responseText
49+
try {
50+
var temp = null;
51+
eval("temp=" + xhr.responseText);
52+
return temp;
53+
} catch (e) {
54+
return {
55+
error: "<h1>Unable to parse server response</h1><p>" + xhr.responseText
5256
+ "</p>"
53-
};
57+
};
58+
}
5459
}
5560
})());
5661
} else if (xhr.readyState === 4 && xhr.status !== 200) {
@@ -116,7 +121,7 @@ DataSource.prototype.getCurrentData = function (callback) {
116121

117122
var _ = this,
118123
__ = this._convert,
119-
mdx = this.BASIC_MDX,
124+
mdx = this.LPT.CONFIG.dataSource["basicMDX"],
120125
mdxParser = new MDXParser(),
121126
mdxType = mdxParser.mdxType(mdx),
122127
ready = {

source/js/LightPivotTable.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ LightPivotTable.prototype.refresh = function () {
6767

6868
};
6969

70+
/**
71+
* @param {string} mdx - New mdx.
72+
*/
73+
LightPivotTable.prototype.changeBasicMDX = function (mdx) {
74+
75+
this.CONFIG.dataSource.basicMDX = mdx;
76+
this.refresh();
77+
78+
};
79+
7080
/**
7181
* Performs resizing.
7282
*/

0 commit comments

Comments
 (0)