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

Setting default filter values in FilterBox #5201

Closed
2 tasks
mmersinger opened this issue Jun 14, 2018 · 2 comments
Closed
2 tasks

Setting default filter values in FilterBox #5201

mmersinger opened this issue Jun 14, 2018 · 2 comments

Comments

@mmersinger
Copy link

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • [ X] I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.25.5

Expected results

I need to set a default value in a filterbox which will then filter non-immune slices on the dashboard the filterbox is added to. I know there is an option to set a filter in a filterbox and then save the dashboard which will retain the filtering when selected. This option does not work when the filter choices in the filterbox may differ for each user. There is no property in the filterbox slice builder to set a default value. I have thought of adding to Dashboard.jsx a new property in formData which may then be leveraged in utils.py when the query is created similar to what extra_filters does now; however, I have not found a means to enforce the use of this "default_filter" only for the first time the dashboard is selected. As for as a default value, I would just use the first value in the list of filter choices. I was able to set a default value in a filterbox by changing the value property in the OnPasteSelect in filter_box.jsx; the issue here is that it does not propagate to the other slices on the dashboard making it ineffective.

Is there a way of knowing when a dashboard is initially selected by a user?
Can setting a default value in the filterbox be added as a new property which is perhaps picked up by extra_filters?

Any thoughts or ideas would be appreciated.

Referred the below issues but did not find a solution.
#3071
#3183
#3618
#665

Actual results

No property option currently available.

Steps to reproduce

Not currently supported to my knowledge.

@mmersinger
Copy link
Author

We have been able to resolve this issue/request. We duplicated the files associated to filter_box to create a single-select filter box. Once we had that object working, we were able to force a default initial value to all columns assigned within this filter box. We added a new property to the controls which allows us to either have a default or to turn default off. All testing to-date on this new object has been good.

@jaswantsinghrana
Copy link

Is it possible to set default value in filter based on logged in user details by using some interim mapping table etc or otherwise?

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

2 participants