From d91a8a72d46a66602fbd17eb0724e3bc43d7c302 Mon Sep 17 00:00:00 2001 From: ZitRos Date: Mon, 28 Dec 2015 19:57:28 +0200 Subject: [PATCH] LPT widget refresh filters apply fix --- export/LightPivotTable-DeepSeePortlet.xml | 15 +++++++++++++-- package.json | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/export/LightPivotTable-DeepSeePortlet.xml b/export/LightPivotTable-DeepSeePortlet.xml index e999e89..88a8b9e 100644 --- a/export/LightPivotTable-DeepSeePortlet.xml +++ b/export/LightPivotTable-DeepSeePortlet.xml @@ -131,8 +131,19 @@ this.LightPivotTable.CONFIG["defaultFilterSpecs"] = []; // updateFilters - for (var i in controller.filters) { - this.LightPivotTable.CONFIG["defaultFilterSpecs"].push(controller.filters[i].spec); + // Getting filters from controller, if it has filters added from URL or default... + // such filters are marked as "transient" + if (controller.filters.length) { + for (i in controller.filters) { + if (controller.filters[i].enabled && controller.filters[i].transient) + this.LightPivotTable.CONFIG["defaultFilterSpecs"].push(controller.filters[i].spec); + } + } + // ... if not, we'll get filters from widget's controls + // Only if the controller didn't have transient filters - (!defaultFilters.length) + if (!this.LightPivotTable.CONFIG["defaultFilterSpecs"].length && widget.filterState instanceof Object) { + for (i in widget.filterState) + if (widget.filterState[i]) this.LightPivotTable.CONFIG["defaultFilterSpecs"].push(widget.constructMDXClause(i, widget.filterState[i])); } if (controller.contextFilterSpec) { this.LightPivotTable.CONFIG["defaultFilterSpecs"].push(controller.contextFilterSpec); diff --git a/package.json b/package.json index f363b3f..84386b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "LightPivotTable", "author": "ZitRo", - "version": "1.4.6", + "version": "1.4.7", "description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache", "main": "test/testServer.js", "repository": {