Skip to content

Commit

Permalink
fixed unimplemented behavior when Drilling Down without filters
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Oct 6, 2015
1 parent d020cca commit 0bdcb80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LightPivotTable",
"author": "ZitRo",
"version": "1.3.1",
"version": "1.3.2",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Then use global object constructed from <i>LightPivotTable</i>:
var setup = { // Object that contain settings. Properties in brackets can be missed.
container: document.getElementById("pivot") // HTMLElement which will contain table.
[, locale: "en" ] // language to use (default: browser default or "en")
logs: false, // enable logs
[, logs: false ] // logging disabled by default
, dataSource: {
MDX2JSONSource: "http://localhost:57772/SAMPLES", // MDX2JSON server address
basicMDX: typeof req === "object" ? req.basicMDX : req
Expand Down
10 changes: 7 additions & 3 deletions source/js/MDXParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ MDXParser.prototype.prependNonEmpty = function (expression) {
MDXParser.prototype.drillDown = function (mdx, filter, expression) {

if (!filter) {
this._warnMDX(mdx, "no filter specified");
return "";
if (/]\s+ON\s+1/.test(mdx)) {
return mdx = mdx.replace(/]\s+ON\s+1/, "].children ON 1");
} else {
this._warnMDX(mdx, "no filter specified");
return "";
}
}

var parts = mdx.split(/(select\s*)(.*?)(\s*from)/ig); // split by SELECT queries
Expand Down Expand Up @@ -133,6 +137,6 @@ MDXParser.prototype.mdxType = function (mdx) {
*/
MDXParser.prototype.applyFilter = function (basicMDX, filterSpec) {

return basicMDX + " %FILTER " + filterSpec;
return basicMDX + (filterSpec ? " %FILTER " + filterSpec : "");

};

0 comments on commit 0bdcb80

Please sign in to comment.