K2 SmartForms

How to: K2 SmartForms ListView sorting

Sorting may be one of the simplest concepts in any application, however, if you don’t understand the prioritising of sorting within a K2 SmartForms ListView, you can find yourself running in circles to apply the correct sorting.

First we will discuss the different ways to apply sorting on a K2 SmartForms ListView after which we will discuss the K2 prioritising of these different sorting methods.

The first option is server-side sorting by either sorting within your SQL stored procedure or your service method.

k2 smartforms listview sorting

K2 SmartForms ListView Sorting – 1

The second option is to apply sorting from the ListView settings. You can find these options from the ListView layout by clicking on the blue cogwheel.

k2 smartforms listview sorting

K2 SmartForms ListView Sorting – 2

In the “Sort” section select configure.

K2 SmartForms ListView Sorting - 3

K2 SmartForms ListView Sorting – 3

You can choose items for the ListView to sort by from the SmartObject you selected when you created the View. If you add more than one item the sorting will be applied for both ordered from the top. You can also choose the sort order – ascending or descending.

K2 SmartForms ListView Sorting - 4

K2 SmartForms ListView Sorting – 4

The third option is to apply sorting whenever you call the method that loads the list data. This option means that you can have a different sorting for every different list load.

K2 SmartForms ListView Sorting - 5

K2 SmartForms ListView Sorting – 5

On the list load rule click on configure to set up the sorting.

K2 SmartForms ListView Sorting - 6

K2 SmartForms ListView Sorting – 6

You can choose items for the ListView to sort by from the SmartObject you selected when you created the View. If you add more than one item the sorting will be applied for both ordered from the top. You can also choose the sort order – ascending or descending.

K2 SmartForms ListView Sorting - 7

K2 SmartForms ListView Sorting – 7

The order in which the sorting will be applied within the K2 SmartForms ListView is:
1. List load method sorting (Option 3)
2. ListView options sorting (Option 2)
3. Server-side sorting (Option 1)

It is important to note that your server-side sorting will be overridden should you have any K2 sorting (option 2 or 3 ) set up. You should also always ensure that your SmartObjects are set to the correct datatype to avoid incorrect sorting since dates, times and numbers will not sort correctly if the datatypes are set to text for example.

More information

More about K2 SmartForm solutions

You may also like

Leave a comment

PODCAST  |  Why you need to establish a K2 Center of Excellence today

Interview with Arno van Rooyen, CEO, Velocity