Let's say there is a tree table displaying a hierarchical structure. There are actually two kinds of objects displayed in the table, one kind forming the internal nodes of the tree and the other one the leaves (e.g. nested categories and articles). The children of every internal node are always either all internal nodes or all leaves.
The items in the table can be filtered by a full-text search and some multi-select filters (e.g. draft/published status of the article). All filters apply to the leaves only; the displayed items are determined by fetching the leaves according to the filters and then adding the internal nodes above them.
All the internal nodes have expand/collapse buttons. There are two buttons, Expand All and Collapse All, in the table header.
How should the filters interact with the expanded/collapsed state in the table? If I start with a fully collapsed table and use the full-text search, it seems obvious that the table should display the matching items fully expanded, since what I'm searching are actually the leaves. If I then cancel the search, should I again see the table fully collapsed, or should items matching the search stay expanded? In general, what should happen to the expanded/collapsed state if I
- add a filter?
- remove/clear a filter?
- edit a filter?
Note that for some filters, "removing" them expands the matching row set (e.g. clearing the search field), while for others, it restricts it (e.g. unchecking the "Draft" checkbox in the "Status" multi-select filter, as long as the "Published" checkbox is checked).
Should the other filters "behave the same", in some way, as the search? Should they also expand all the matching items?
Should there perhaps be a "Reset" / "Clear all filters" button (that would behave differently from just clearing all filters one by one)?
How should the Expand All and Collapse All buttons interact with everything? It seems obvious that they should only act on visible items, i.e. those matching the current filters, but anything beyond that?
I'm racking my brain trying to think of all the possible combinations of user actions and the desired outcomes. To give a single semi-comprehensive scenario:
I start with a fully collapsed table. I manually expand some internal nodes. I enter a word into the search field, getting some results. I add a multi-select filter, restricting the result set further. I again expand/collapse some of the displayed nodes. I select a different item in the multi-select filter. I clear the multi-select filter. I clear the search (so now, the table should be displaying all data). What should the expanded/collapsed state be after every step of this scenario?
Thanks in advance for any suggestions!