Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to sort a ListView in code

$
0
0

In this example, we demonstrate how to apply sorting by a property of your business object, and disallow end-users from changing this sorting themselves. Consider the following scenario: we have an Issue business class that has the ModifiedOn property, and we need to show the last modified issue always on the top of the grid. This can be done if we implement a ViewController for the Issue ListView, and configure sorting for the required column of this ListView in the application model. This is done in the SortListViewControllerBase class, which is platform-agnostic.
After that, we should implement platform-dependant controllers that will disable the sorting functionality in the grid. Take special note that by using this approach, your end-users will see that the grid is sorted by a column (a small arrow will be shown in the column header). Alternatively, you can use the Sorting property of the ListView application model element.
This approach can be used to sort both nested and root ListViews, and also will work if the server mode is enabled in the ListView.

See Also:
How to sort a nested ListView at the business objects level, in code
How to prevent sorting and grouping by certain columns in a ListView
How to: Access the Application Model in Code

Example Comments

Added By: R. Frese at: 6/17/2013 7:04:04 AM    

Doesn't work at all.
Nothing sorted in the ListView.

Added By: Dennis (DevExpress Support) at: 6/17/2013 8:32:39 AM    

Hello,

This example works as designed in my tests. From the example's description:

In this example, we demonstrate how to apply sorting by a property of your business object, and disallow end-users from changing this sorting themselves.

Let me know if your http://www.devexpress.com/Support/Center/Question/Details/Q502821 ticket if there any questions.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>