Refresh options for embed dependent filters

Refresh options for embed dependent filters

With regard to “refresh options” for external dependent dropdowns applied to Metabase embeds as mentioned in this dated post:

What “refresh options” work best as a workaround until GitHub Issue #5540 is implemented? Can new selection(s) in the last dependent dropdown in the cascade be applied without loosing filter selections already made within the embedded dashboard?

@AndrewMBaines in particular, you’ve worked quite allot on this, any insights?

The way I worked it was to just have the lowest level filter in the dashboard itself. The host page has 4 dropdowns and the code for the host page handles all the SQL to populate them.
Even when nothing is selected (ie show everything), you need to pass values to the dashboard parameter. In my case that wasn’t a problem as there are only about 50 possibilities.
I have a single view on the database that returns data for all 4 dropdowns, but it’s queried 4 times rather than doing the filtering in the code.
There’s no caching of the dropdowns as such as most of the users are only interested in one area (it’s teams of people).

Thanks @AndrewMBaines, very helpful. How do you manage to populate the lowest level filter on the dashboard itself?

The dashboard is embedded and the parameter locked:
image

In .Net, I create a dictionary and populate that with all the potential values, then pass it with all the jwt stuff.
It’s a bit different if your development environment supports json properly, but the principles are the same.

Oh, OK, the last of the dropdowns is in the dashboard as a Locked Parameter. That makes more sense, I was reading it as though it was a visible filter within the dashboard.

So when a user makes a new selection in the final dropdown, it being a Locked Parameter, the dashboard updates itself without loosing previously chosen options in those filters visible in the dashboard? There’s no need to provide a refresh option?

Pardon my possibly silly question, I’m very close but not quite done with the code that passes that last external dropdown’s selections to the Locked Parameter so I haven’t had the benefit of seeing it in action yet!

I only have the one parameter, so not sure what happens to any others. My problem with the built-in parameters was the amount of vertical space they take up.