Skip to content

Configurable filters #74

@lorenzulrich

Description

@lorenzulrich

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions