GitHub user dosubot[bot] added a comment to the discussion: How to retrieve filter dataMask when applying filter on embedded dashboard
<!-- Greeting --> Hi @Crystal701! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> Yes, you can retrieve the current filter state (dataMask) from an embedded Superset dashboard via postMessage using Superset's built-in Switchboard messaging protocol. To enable this, set the EMBEDDED_SUPERSET feature flag to True in your superset_config.py. There is no separate config flag specifically for filter state transfer—it's controlled by frontend URL parameters and the embedding feature flag [source](https://github.com/apache/superset/issues/33702). To have the embedded dashboard automatically emit filter state changes to the parent, add uiConfig=16 (or any value with the '16' bit set) to your iframe src URL. This enables the emitDataMasks flag, which causes the dashboard to post dataMask updates to the parent window whenever filters change [source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/components/UiConfigContext/index.tsx). You can also use Switchboard methods like getDataMask to request the current filter state from the embedded dashboard on demand [source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts). No CSS or JS injection is needed for this communication if you use the supported embedding and Switchboard features. For persistence, you can use FILTER_STATE_CACHE_CONFIG in superset_config.py to cache filter state, but this is not required for postMessage-based access [source](https://github.com/apache/superset/discussions/33957). In summary: enable EMBEDDED_SUPERSET, use uiConfig=16 in your iframe URL, and use Switchboard postMessage methods to access or listen for dataMask changes from the parent application. This will let you retrieve filter state and generate permalinks outside the iframe. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ca0af7de-e1a9-4593-8946-a6ad5197a26d?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34277) GitHub link: https://github.com/apache/superset/discussions/34277#discussioncomment-13862808 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
