You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "thalmis-zt (via GitHub)" <gi...@apache.org> on 2025/01/21 07:44:24 UTC
[I] Unable to apply filters for individual chart embeddings, by passing filters as url params [superset]
thalmis-zt opened a new issue, #31937:
URL: https://github.com/apache/superset/issues/31937
### Bug description
I want to apply filters on the chart by passing the filters in the url as params. This is how I am doing it
<script>
const supersetHost = 'http://localhost:8088';
const tableSliceId = 671;
const formData = {
slice_id: tableSliceId,
adhoc_filters: [
{
clause: 'WHERE',
expressionType: 'SIMPLE',
subject: 'state',
operator: 'IN',
comparator: '247'
}
],
standalone: 1
};
// Stringify and encode the form data
const encodedFormDataFive = encodeURIComponent(JSON.stringify(formData));
const url = `${supersetHost}/superset/explore/?form_data=${encodedFormData}&slice_id=${tableSliceId}&standalone=1&height=400`;
</script>
<iframe
width="600"
height="400"
seamless
frameBorder="0"
scrolling="no"
title="with embedding charts enabled"
src={url}
>
</iframe>
### Screenshots/recordings
**Expected** chart

**What I am seeing**

### Superset version
4.0.2
### Python version
3.10
### Node version
18 or greater
### Browser
Chrome
### Additional context
The feature flags are
FEATURE_FLAGS = {"ALERT_REPORTS": True, "EMBEDDED_SUPERSET": True, "EMBEDDABLE_CHARTS": True, "ALLOW_ADHOC_SUBQUERY": True}
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Unable to apply filters for individual chart embeddings, by passing filters as url params [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #31937: Unable to apply filters for individual chart embeddings, by passing filters as url params
URL: https://github.com/apache/superset/issues/31937
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Unable to apply filters for individual chart embeddings, by passing filters as url params [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31937:
URL: https://github.com/apache/superset/issues/31937#issuecomment-2603876354
<!-- Greeting -->
Hey @thalmis-zt 👋, I'm here to assist you with any bugs, questions, or contributions. Just give me a shout if you need help!
<!-- Answer -->
I found a similar unsolved discussion titled [Filter from url](https://github.com/apache/superset/discussions/30922) which might be relevant to your issue <sup>[[1]](https://github.com/apache/superset/discussions/30922)</sup>.
Regarding your issue, it seems like you are trying to apply filters to a chart by passing them as URL parameters. Superset processes the `form_data` parameter in the URL by replacing it with a `form_data_key`, which is stored in the cache layer. This transformation is handled by the `get_redirect_url` method, which creates a `form_data_key` and modifies the URL accordingly <sup>[[2]](https://github.com/apache/superset/blob/master/superset/views/core.py)</sup>.
Additionally, there are specific configurations in Superset that affect the application of URL parameters for chart filters. The `URL_PARAMS` object defines parameters like `preselectFilters`, `nativeFilters`, and `showFilters`, which can influence chart behavior. Make sure these parameters are correctly set in your URL <sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/src/constants.ts)</sup>.
You might want to verify that the `form_data` is being correctly processed and that the necessary parameters are included in your URL. If the issue persists, consider checking the Superset logs for any errors that might provide more insight.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/140ffa9c-6481-40c0-99c1-f63e6221350c?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org