Search Functionality

0
Hi Mendix World, How can I implement a search functionality on a Datagrid that is populated using a Microflow or over Association. The output of my Microflow is a list that is displayed in a DataGrid. I need to perform Search operation to filter the data. How can i acheive this?
asked
2 answers
0

You can add a filter attribute to the main object of the form. Use the value of that attibute to filter data in the datasource microflow. Add an onchange event to the filter text edit to refresh the main form and trigger the datasource microflow to refresh the grid.

answered
0

(Edit: I will clarify my answer as soon as my FTP server is back online so I can upload pictures...)

Another (bit labor intensive) way would be to create a tree of NP objects, 1 SearchObject and several FilterObjects associated to the SearchObject.

The FilterObject NP objects all get a Boolean attribute 'Show', default value = true.

The SearchObject is placed in a data view, inside that, a datagrid is embedded which is filled by a DS microflow. This DS retrieves all FilterObjects that are associated with the SearchObject and outputs only the FO objects with 'Show' = true.

To complete the structure, make custom filter options in the data view with the SearchObject in it (i.e. dropdowns, checkboxes etc). Make an OnChange event for each of these filter options which has the SO as an input parameter, then goes through all FO to set those that will not be shown to 'Show' = false and refresh the SO in client.

Each time you apply a filter option, all FO objects will be hidden (Show = false), while the ones that are correct will be shown (Show = true).

This way, you'll be able to custom fill your datagrid while maintaining search and filter options. As said before, it's labor intensive, but it gets the job done. :)

answered