Skip to content

Data views: Advanced filtering #64898

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

Open
jameskoster opened this issue Aug 29, 2024 · 3 comments
Open

Data views: Advanced filtering #64898

jameskoster opened this issue Aug 29, 2024 · 3 comments
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Type] Enhancement A suggestion for improvement.

Comments

@jameskoster
Copy link
Contributor

The current filtering capabilities in data views are powerful, but there are some restrictive details. For instance you cannot combine filters of the same type, and there's no way to modify the operator between filters.

In other words you could not filter the Posts data view to show posts where:

Category is: category X, and any of: category Y, category Z, or Tag is: Tag X, and Tag is not: Tax Y, Tag Z.

How might we extend the filter UX to cater to such options?

One idea would be to provide an "Advanced filter" option in the Add filter menu. It would add a filter chip like any other, but the configuration popover would be more comprehensive. Here's a very rough mockup to demonstrate the idea:

Screenshot 2024-08-29 at 11 15 52
@jameskoster jameskoster added [Type] Enhancement A suggestion for improvement. [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Aug 29, 2024
@verofasulo
Copy link

@jameskoster, thank you so much for kicking this off! I tested it in Woo Analytics using advanced filters only. Combining simple and advanced filters ended up feeling a bit clunky and introduced conflicts, requiring extra work to transition simple filters into advanced ones (as per Notion approach).

Single.report.-.Advanced.filtering.mp4

Here's a video showing how Notion allows users to transition from simple filters to advanced ones. Is it something we're thinking of?

Notion.approach.mp4

@jameskoster
Copy link
Contributor Author

To me it seems fine for DataViews consumers to utilise any combination of filters types. The add filter button should adapt accordingly:

  • Only simple filters (already shipping).
  • Only advanced filters: Clicking the filter button could add the filter and open the configuration dialog (similar to your mockup).
  • A combo of both: Append 'Advanced filter' to the list of options in the add filter menu (similar to Notion). Selecting 'Advanced filter' would add the filter and open the configuration dialog.

In your case you'd omit any simple filters to streamline the workflow. What do you think?


Transforming/adding a simple filter to the advanced filter is a nice flow, but I suspect it could be a lot of extra work:

  • The design may need to vary per filter type.
  • We'd need to work out the semantics of including a menu in filter configuration dialogs.

It's probably a detail to explore in a separate issue.

@danieliser
Copy link
Contributor

danieliser commented Jan 5, 2025

Looking at adopting DataViews as we’ve already built similar that is a bit further along but no point in diverging from core more.

That said I’ve got a lot to potentially contribute.

First being I’ve long been building conditional Boolean systems and UX for over a decade in our plugins.

We have ready to go RuleEngine components that could be ported much easier than creating this from scratch.

Check it out in Content Control plugin (https://github.com/code-atlantic/content/control/ under packages/rule-engine)

Ours already is built out in full Typescript and supports

  • fully accessible, can be used keyboard only
  • nested grouping,
  • drag and drop sorting with visual drop zones
  • AND / OR grouping
  • Dynamic verbs
  • custom fields per rule
  • proper state handling
  • validation
  • copy/paste of rules
  • and quite a bit more.

Also been tested in the wild on tens of thousands of installs of not hundreds of thousands.

Also have matching JS and PHP OOP handlers for processing said rules depending on where it needs to take place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants