Pre defined filter value

0
Hi all,   I'm using the dropdown filter widget to filter my orders on a specific status (enum atribute on order)   This works fine, but 1 miss 1 thing: Is there a way to enter the page and already have a value set for the filter (for example status “new”)?
asked
1 answers
1

You are correct – the widget does not have that feature. If you or someone here would like to add this feature, please feel free to send me a pull request: https://github.com/tieniber/GridSearch

There is a way to achieve this functionality today. To do so, you’d need to use the AnySearch widget. With AnySearch, you use a non-persistent object to store a string of XPath, which the widget applies to your grid. Use a combination of input widgets and microflows/nanoflows to set that XPath string to the condition you need. In your case, it probably looks like this:

  • Make a helper entity with 2 attributes:
    • An enum of the status you’re tracking in your question
    • An unlimited string that will hold the xpath condition
  • On the page, create a data view sourced by microflow. In the microflow, create the helper object and pre-set the enum and XPath strings as needed
  • Put the anysearch widget inside the data view.
  • Put a dropdown widget for the enum inside the data view
  • Make an on-change nanoflow (or microflow) on the dropdown, which uses the value of the dropdown to update the xpath attribute. Note: you don’t need to “refresh in client” the helper object
answered