ListView Sorting based on a field

hi all,   I have a listview whose datasource is association. Now if i see carefully the order in which the items are appearing is based on the oder in which they are created. I want to do this over another field which is an Integer(for simplicity sake) which a field in this Entity over which ListView is running I have 1 or ways but they are workarounds in my view(like recreation of the instance based on this field) Since this is a UI matter i was wondering if this can be achieved using something else? like java script from the ListView widgets listeners?(shot in the dark i know)
4 answers

As mentioned by Mike earlier, there are 3 datasource options for a ListView:

1. Association

2. Database + XPath

3. Microflow

Long story short: The database and microflow options support sorting, and the association option does not.

So I guess the real question is: Can we add sorting capabilities to the Association option in a future version of Mendix modeller?


The typical way to handle this limitation is to use a microflow datasource:

  • retrieve the objects you want over association
  • sort them
  • return the sorted list


From the Mendix documentation:

The list view supports the following types of data sources: database source, XPath source, association source and microflow Source. The database and XPath sources retrieve objects from the database and supports searching and sorting. The database source can also be used in offline applications. The association source follows an association from the enclosing data view to get to the objects. Finally, the microflow source calculates the list of objects by executing a microflow.

So you can't sort with an association source.  I think you'll need to change your source or create an interim entity with the objects sorted as you want them to be sorted...

Unless someone else in the community has a workaround.



Solved using dedicated MF and Button