awslabs / amazon-quicksight-embedding-sdk

A SDK to help users embed QuickSight dashboards on other pages.
Apache License 2.0
171 stars 40 forks source link

setParameters cannot clear selection #205

Closed mariadelacamara closed 6 months ago

mariadelacamara commented 6 months ago

I have an external control, for UI reasons, that calls setParameters to update a multi-value property. I would like to unselect all values in this property but if I use setParameters( { [property]: [] } ), nothing happens. I've tried using '', undefined, null, etc but nothing works, these values are considered a new option in the list.

Is this a bug or is intended behavior? if that's the case why?

We sent empty array but the old value remains there. The only way we can change the value is to select a different(s) one(s). So Idk why this support empty array when you first navigate to the dashboard, but not after. Is there any solution for this?

PS:

onMessage: async (messageEvent) => {
                switch (messageEvent.eventName) {
                    case 'PARAMETERS_CHANGED': {
                        // messageEvent.message contains all parameters with active values
                        console.log(JSON.stringify(messageEvent.message));
                        break;
                    }
                }
            },

When we clear the parameters and the param objet is:

 {
        Name: '<YOUR_PARAMETER_NAME>',
        Values: []
    }

this message is still reflecting the old value instead of []

brianwyka commented 6 months ago

You need to send it as either ["ALL"] or ["ALL_VALUES"] in order for it to work...

 {
    Name: '<YOUR_PARAMETER_NAME>',
    Values: ["ALL_VALUES"],
}

This will be configured for the parameter on the QuickSight side. Here is docs on CategoryFilter for example: https://docs.aws.amazon.com/quicksight/latest/APIReference/API_CustomFilterConfiguration.html

brianwyka commented 6 months ago

See also #203

mariadelacamara commented 6 months ago

Thanks! that works fine :)