Skip to content

Commit e06794c

Browse files
v23entv23ent
authored andcommitted
Filters processing
Changed filters processing from MDX2JSON to values that are set either in controller or in widget
1 parent 22ac3f0 commit e06794c

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

export/LightPivotTable-DeepSeePortlet.xml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@
183183
exportToExcel = !!parseInt(container.getAttribute("export-csv"));
184184
185185
// !ultra-bydlocode (get the widget object)
186-
while (widget["parent"]) {
186+
// ++ VP
187+
// Following "parent" until we find widget object
188+
while (!widget["widgetKey"]) {
187189
widget = widget["parent"];
188190
}
191+
// -- VP
192+
189193
// !ultra-bydlocode (possible you will have better suggestions to get widget key)
190194
widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]);
191195
@@ -233,7 +237,7 @@
233237
(source = location.origin + "/" + container.getAttribute("data-source"))
234238
+ "/Widgets?Namespace=" + container.getAttribute("namespace"),
235239
{
236-
Dashboard: widget["dashboardName"]
240+
Dashboard: zenPage["dashboardName"]
237241
},
238242
function (data) {
239243
if (data.error) {
@@ -246,16 +250,6 @@
246250
}
247251
}
248252
//console.log(info);
249-
if (info.controls instanceof Array) {
250-
for (i in info.controls) {
251-
if ((info.controls[i].action === "applyFilter" || info.controls[i].action === "setFilter") && info.controls[i].value) {
252-
if ((filterValue = info.controls[i].value).charAt(0) === "%" && filterValue.indexOf(" ") > 1) {
253-
filterValue = filterValue.split(" ")[1] + "." + filterValue.split(" ")[0]
254-
}
255-
defaultFilters.push(info.controls[i].targetProperty + "." + filterValue);
256-
}
257-
}
258-
}
259253
setup = {
260254
container: container,
261255
dataSource: {
@@ -272,6 +266,19 @@
272266
}
273267
}
274268
}
269+
// ++ VP
270+
// Getting filters from controller, if it has filters filled...
271+
if (controller.filters.length) {
272+
for (i in controller.filters) {
273+
if (controller.filters[i].enabled) defaultFilters.push(controller.filters[i].spec);
274+
}
275+
// ... if not, we'll get filters from widget's controls
276+
} else if (widget.filterState instanceof Object) {
277+
for (i in widget.filterState)
278+
if (widget.filterState[i]) defaultFilters.push(widget.constructMDXClause(i,widget.filterState[i]));
279+
}
280+
// -- VP
281+
275282
if (controller.contextFilterSpec) {
276283
defaultFilters.push(controller.contextFilterSpec);
277284
}

0 commit comments

Comments
 (0)