order

Returns a copy of the list sorted according to the direction

Parameters

selector Object

The current sort configuration.

selector.field String | Function

The field by which the data items are sorted.

dir String

The sort order (direction). The supported values are "asc" (ascending order) and "desc" (descending order).

Returns

kendo.data.Query Returns a new instance of kendo.data.Query containing the sorted collection

Example

<script>
    const query = new kendo.data.Query([
        { name: "Jane Doe", age: 30 },
        { name: "John Doe", age: 33 },
        { name: "Bob Smith", age: 25 },
        { name: "Alice Johnson", age: 28 }
    ]);
    
    const sortedQuery = query.order("age", "desc");
    const result = sortedQuery.toArray();
    // the result can be seen in the browser console.
    console.log(result); // Will be sorted by age in ascending order
</script>
In this article
order
Not finding the help you need?
Contact Support