Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superset Dashboard with native filter does not correctly update when opened #27787

Open
3 tasks done
pmainguet opened this issue Mar 29, 2024 · 4 comments
Open
3 tasks done

Comments

@pmainguet
Copy link

Bug description

Hello Superset team

I have a dashboard with native filters on two dimensions ComId and Country that I access via the following URL:

http://xxx.com/dashboard/74/?standalone=2&native_filters=(NATIVE_FILTER-4muGsWvuM:(cache:(label:%27fr%27,validateStatus:!f,value:!(%27fr%27)),extraFormData:(filters:!((col:country,op:IN,val:!(%27fr%27)))),filterState:(label:%27fr%27,validateStatus:!f,value:!(%27fr%27)),id:NATIVE_FILTER-4muGsWvuM,ownState:()),NATIVE_FILTER-mV48ONcz5:(cache:(label:%27100565400%27,validateStatus:!f,value:!(%27100565400%27)),extraFormData:(filters:!((col:merchant_id,op:IN,val:!(%27100565400%27)))),filterState:(label:%27100565400%27,validateStatus:!f,value:!(%27100565400%27)),id:NATIVE_FILTER-mV48ONcz5,ownState:()))

The dashboard open corretly, the filters are correctly set on the left side of the screen, but the filters are not applied to the data. I need to click on "Apply Filters" to have the correct view.

Step 1 - All panels load
Step 1 - all panels load

Step 2 - Unfiltered data loads
Step 2 - unfiltered data loads

Step 3 - Filters load on the left side
Step3 - Filters load

Step 4 - Correct view after clicking on Apply Filters
Step 4 - Correct view after clicking on Apply Filters

I believe it is due to the fact the unfiltered data is first loaded and then the filters are set in the dropdown.
I tried to use Jinja templating in my queries to force loading the filtered data but in that case i get an error, as the filters are not set hence my Jinja templates are empty.

Is there a way to autorefresh the dashboard after the filters are set to get the filtered view right away, or another work around ?

Tested on Superset 2 and 3

Thanks in advance

How to reproduce the bug

Open a dashboard with native filters

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • 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.
@ftwegner
Copy link

ftwegner commented Jun 3, 2024

Here is a response from a Apache Superset PMC member:

As the GitHub issue's open status indicates, this is sadly not supported at this time. I don't think it's on anyone's near-term roadmap that I'm aware of, either. This is one of those "contributions welcome" areas if you have any engineering support in your org that might be able to contribute such a feature (e.g. an "applyFiltersInstantly=true" URL param or something along those lines.

@rusackas
Copy link
Member

rusackas commented Jun 3, 2024

It may also be worth noting that when you configure dashboard filters, you can set default values, and these are automatically applied. That may or may not help, depending on your use case.

@ftwegner
Copy link

ftwegner commented Jun 3, 2024

I got the automatic filtering solved. I found the problem. It was sitting before the keyboard. In the URL I was using the wrong value for the parameter. When applying the second "name" tag from the "targets" section as the filtering works as expected, see the screenshot below. The code from the article Apache Superset — Use URL to filter dashboards works exactly as I need it now.

native_filters=(NATIVE_FILTER-<id>:(__cache:(label:'<value>',validateStatus:!f,value:!('<value>')),extraFormData:(filters:!((col:<column>,op:IN,val:!('<value>')))),filterState:(label:'<value>',validateStatus:!f,value:!('<value>')),id:NATIVE_FILTER-<id>,ownState:()))

image

@rusackas
Copy link
Member

rusackas commented Jun 4, 2024

And it applies automatically? Does that effectively close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants