ListView - Columns Sorting

0
Hello All, I’ve gone through many forums but couldn't able to find the right one for my scenario! I’ve a page built on ‘ListView’ with data source as ‘Microflow’ and my page has 4 fields/Columns. Requirement: User should be able to Sort  using Ascending, and Descending on each column/field. Any idea how to achieve this? In my scenario, Note: The entity which I have on the page is “Non-Persistent”
asked
4 answers
2

To sort a list that is sourced from a microflow, you should wrap your list in a “Helper Entity”. The helper entity becomes a parameter in the data source microflow, and you can use it to store properties like:

  • The current sorted column
  • Whether it’s ascending or descending
  • Search/filter parameters
  • Paging

Once you have this data available as an input to your data source microflow, you can make decisions in there and return the appropriate list of data.

Here is a demo project where I implemented sorting on 2 columns of a list view. My data source microflow in this case just fetches data from the Mendix database, but you could use this pattern for a list sourced from an API as well. Grab this and see if you can extend it to the other 2 columns.

 

answered
0

There is a sorting for listview added in 7,23: https://docs.mendix.com/releasenotes/studio/7.23#new-features

Also you can use the Appstore App ‘Listview Controls’  which has some sort options, among which header sort and dropdown sort. Use which you like best.

answered
0

Appreciate anyone’s responses on this one.

answered
-1

The sorting you do in the listview is pretty static, because you define it in the Modeler, but these options are only possible if the source is from Database. As far as I'm aware you can't sort listviews if the source is a Microflow via the properties. If you want certain sorting, you have to build that in the Microflow.

Not familiar with the Appstore App ‘Listview Controls’. But scrolling through the documentation I didn't find anything about database source or microflow source.

answered