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

Configurable filters #74

Open
lorenzulrich opened this issue Jul 12, 2024 · 0 comments
Open

Configurable filters #74

lorenzulrich opened this issue Jul 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@lorenzulrich
Copy link
Collaborator

FlatNavs are useful to handle listings of data, e.g. blogs, news records etc.. While there is a search by query options, no filtering is possible. This ticket is meant to discuss a concept for additional filters and the implementation.

I think it should be possible to configure additional filters. For the filters, an optionsQuery (to fetch the possible filter options) and a query for the actual result could be defined. This could work like this:

Neos:
  Neos:
    Ui:
      frontendConfiguration:
        Psmb_FlatNav:
          presets:
            tree:
              type: tree
              label: Tree
              icon: globe-europe
            news:
              label: News
              icon: newspaper
              type: flat
              query: 'q(node).find("[instanceof FoobarCom.Site:Document.NewsPage]").sort("date", "DESC").slice((page - 1) * 100, page * 100).get()'
              # searchInProperties is a custom FlowQueryOperation
              searchQuery: 'q(node).find("[instanceof FoobarCom.Site:Document.NewsPage]").searchInProperties(searchTerm, ["title"]).sort("date", "DESC").get()'
              filters:
                category:
                  label: 'Category'
                  type: select
                  optionsQuery: 'q(node).find("[instanceof FoobarCom.Site:Category]").sort("title", "ASC").get()'
                  optionLabelProperty: 'title'
                  optionValueProperty: 'identifier'
                  # filterByCategory is a (hypothetical) custom FlowQueryOperation to which we pass the current filter value
                  query: 'q(node).find("[instanceof FoobarCom.Site:Document.NewsPage]").filterByCategory(value).sort("date", "DESC").slice((page - 1) * 100, page * 100).get()'
              newReferenceNodePath: '/sites/foobarcom/node-a9wbwksudib29/node-99e120xp6bt1t'
              newNodeType: 'FoobarCom.Site:Document.NewsPage'
@lorenzulrich lorenzulrich added the enhancement New feature or request label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant