在网格中指定默认排序
使用敲除Kendo绑定来绑定Telerik Kendo网格时,是否可以指定默认排序?
Is it possible to specify a default sort when using the knockout-kendo binding to bind the Telerik Kendo grid?
我这样绑定网格:
kendoGrid: { data: grid.Rows, sortable: {allowUnsort: false,mode:'single'}, columns: grid.Columns}
但是,我还没有找到指定默认排序的方法.
标准Kendo具有可以在数据源上指定的sort:{field:"Col1",dir:"asc"}
元素,但尚不清楚如何将其应用于kendoGrid
绑定
However, I have not found a way to specify the default sort.
Standard Kendo has a sort:{field:"Col1",dir:"asc"}
element that can be specified on the data source, but it's unclear how this can be applied to the kendoGrid
binding
默认Kendo排序元素: http://docs.telerik.com/kendo-ui/api/framework/datasource#sort-array--objectdefault
Default Kendo sort element: http://docs.telerik.com/kendo-ui/api/framework/datasource#sort-array--objectdefault
以下答案中的评论为我提供了一个线索:
The comments from the following answer gave me a clue:
什么kendo-kendo网格小部件中的data和dataSource之间有什么区别?
如果要指定此行为,似乎可以串联使用data和dataSource:
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}