Is there a way to call a widget's "Clear Selection" from a widget script?
Is there a way to call a widget's clear selection from a widget's custom script?
I want to be able to do what the "Clear Selection" button does on a widget that "Affects Dashboard filters", programmatically through custom JavaScript.
I'd like to make this function call work but it doesn't.
var W =
prism.activeDashboard.widgets.$$widgets.find( (x) => { return (x.title == "Bar Chart Widget"); } );
prism.$command.execute('dashboard.commands.clearWidgetSelection',
{$scope: prism.user},
{dashboard: dashboard, widget: W});
-
Hey Barry,
Instead of trying to click the button progmatically, it may be easier to just replicate the effects.
I would through prism interate through your dashboard filters and set the filter jaql for all to be
{
"explicit": false,
"multiSelection": true,
"all": true
}
Which is basically just the include all filter.Would this work?
-
Hi Nathan Giusti,
I'm trying to only clear one specific filter that is controlled by a bar chart widget in this case.
I can see that the 'Clear Selection' button ultimately calls this command and I think I'm close except that I am passing in the wrong argument(s).
prism.$command.execute('dashboard.commands.clearWidgetSelection',
{$scope: prism.user},
{dashboard: dashboard, widget: W});I've also come up with this:
if (0 < Widget.metadata.selectionData().length) {
Widget.metadata.clearSelection();
}
Please sign in to leave a comment.
Comments
2 comments