在网格中指定默认排序 [英] Specifying default sort in grid

查看:84
本文介绍了在网格中指定默认排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用敲除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}

这篇关于在网格中指定默认排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆