-
My goal: I want to set and unset filter stacks on a table using other components (e.g., buttons), allowing the user to rapidly switch between different filter sets on the table.
-
Issue: I can’t figure out if a
filterStackcan have anidproperty, like thefiltercan. If it can’t, then do I need to clear the filter stack every time before applying a new filter stack? -
Steps I've taken to troubleshoot: I’ve checked the docs and didn’t see anything.
-
Additional info: Cloud Hosted. I’m setting my filters like this:
Also to quickly add, it would be useful if there was a filter stack ID, so I could key off that for certain other items (e.g., if table has filterStack id = ABC applied, then the button that set it should have a success background).
Hi @npr,
Great question. From my testing, it seems that individual filters have ID properties, with filter stacks being composed of one to many filters.
When I viewed the filterStack property on a table, it seems to not have an ID representing a stacks unique combination of filters inside the stack.
For your use case, are you looking to use buttons to allow users to switch between which single filter is being applied? Or are you also looking to have two or more filters applied at once, in which case you would need to clear the filter stack and then add multiple filters onto the table at once?
If you are only ever applying one filter, you don't need to clear the stack, and each button only needs to invoke .setFilter via the event handler.
If you are having buttons apply multiple filters at once via the filter stack functionality, then you do need to first clear the stack and then apply a new stack if you do not want to include the previous stack's filters.
I just tested this out and if you have a filter stack and then invoke set filter, the stack will not be automatically cleared and the table will have the filters from the stack as well as the newly added filter set by the event handler.
Yes I agree having IDs to correspond to unique arrays of multiple filter objects would be helpful.
I can make a feature request for that right now ![]()
Thanks for looking into it! I’d like to apply many different overlapping sets of filters. Good to know ![]()
