Widget filter through code not working
AnsweredHi Team,
we are trying to modify/apply widget level filter with the below code:
widgetObj.metadata.panel('filters').items.push({
jaql: {
dim: '[PEC Dim.EXTRA_COST_NAME]',
filter: {
'explicit': false,
'multiselection': true,
'members': ["ADDER"]
},
datatype: "text"
}
});
widgetObj.refresh();
However, we see that the filter is not applied on the embedded page. Please suggest.
-
Hi,
If using your code, after each change like that, you will need to call
widgetObj.changesMade();
This will save your changes into the mongoDB and it should be reflected in the embedded page.
However, I would suggest instead of changing the metadata object which changing the widget itself (for permanent), to use 'beforequery' event (on the widget).
In that event, you can change the query sent to the server before it is sent. In that way, you still do your changes and the widget stay in his original state - of course, depends on what you are trying to achieve.
Let me know if you any other question.
Please sign in to leave a comment.
Comments
1 comment