From 811ac36513416a3c6d6befea778015ff5886379d Mon Sep 17 00:00:00 2001 From: ZitRos Date: Sat, 15 Oct 2016 12:40:10 +0300 Subject: [PATCH] Not displaying totals fix, no data message display --- package.json | 2 +- source/js/DataController.js | 2 +- source/js/DataSource.js | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 35df963..042fa88 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "LightPivotTable", "author": "ZitRo", - "version": "1.6.9", + "version": "1.6.11", "description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache", "main": "test/testServer.js", "repository": { diff --git a/source/js/DataController.js b/source/js/DataController.js index 53ee587..0fa0561 100644 --- a/source/js/DataController.js +++ b/source/js/DataController.js @@ -119,7 +119,7 @@ DataController.prototype.setData = function (data) { */ DataController.prototype.pivotDataProcess = function ( data ) { - var totals = this.controller.getPivotProperty(["columnTotals"]); + var totals = this.controller.getPivotProperty(["rowTotals"]); if (typeof totals === "boolean") { this.controller.CONFIG["showSummary"] = totals; diff --git a/source/js/DataSource.js b/source/js/DataSource.js index 3edb8af..df03273 100644 --- a/source/js/DataSource.js +++ b/source/js/DataSource.js @@ -222,9 +222,16 @@ DataSource.prototype.getCurrentData = function (callback) { })(data)); } else if (mdxType === "mdx") { + if (!data || !data.Data || !data.Cols + || (!data.Data.length && !((data.Cols[0]||{}).tuples||[]).length) + && !((data.Cols[1]||{}).tuples||[]).length) { + return callback({ + error: pivotLocale.get(4) + }); + } callback(_._convert(data)); } else { - callback({ error: "Unrecognised MDX: " + mdx || true }); + callback({ error: "Unrecognised MDX type: " + mdx || true }); } };