While using the components that operate on data, such as grid, list or chart, you often need to implement sorting.
Dataset sorting consists in the method sort() (see details in the corresponding chapter of the manual).
And can be implemented in two ways:
There are three predefined sorting expressions:
$$('mylist').sort({ by:"#year#", dir:"asc", as: "int" });
A sorting method is defined by a function. This function is called for each pair of values and returns 1,-1 or 0:
$$('mylist').sort({ by:"#time#", dir:"asc", as: sortTime }) function sortTime(a,b){ ... }
Related sample: 04_list/13_sorting.html