Skip to content Skip to sidebar Skip to footer

Specifying Default Sort In Grid

Is it possible to specify a default sort when using the knockout-kendo binding to bind the Telerik Kendo grid? I am binding the grid like this: kendoGrid: { data: grid.Rows, sortab

Solution 1:

The comments from the following answer gave me a clue:

What is the difference between the data and dataSource in knockout-kendo grid widget?

It seems like you can use data and dataSource in tandem if you want to specify this behavior:

kendoGrid: {dataSource:{sort:{field:'Col1',dir:'asc'}}, data: grid.Rows, sortable: {allowUnsort: false,mode:'single'}, columns: grid.Columns}

Solution 2:

Check out the following post in the kendo forums.

http://www.telerik.com/forums/default-sort-for-kendo-grid-mvc

.DataSource(dataSource => dataSource
        .Ajax()
        .Sort(sort => sort.Add("City").Ascending()) // <-- initial sort expression
        .Read(read => read.Action("Index", "Home"))
    )

Post a Comment for "Specifying Default Sort In Grid"