Kendo grid 加载时基于一列的剑道排序

Kendo grid 加载时基于一列的剑道排序,kendo-grid,Kendo Grid,我的代码如下: $("#grid").kendoGrid({ dataSource: { data: setData(), pageable: false }, scrollable: true, sortable: true, selectable: true, columns: [ { field: "Name", title

我的代码如下:

$("#grid").kendoGrid({
        dataSource: {
            data: setData(),
            pageable: false
        },
        scrollable: true,
        sortable: true,
        selectable: true,
        columns: [
            { field: "Name", title: "Name", width: 230" },
            { field: "Sex", title: "Sex", width: 50},
            { field: "Ca", title: "C.A." , width: 55},
            { field: "TotalScore", title: "Total Score", width: 100},
            { field: "Rank", title: "Rank", width: 60 }
        ]
    });

现在我想要的是,当第一次加载页面时,我希望数据按
“TotalScore”
排序。怎么做


谢谢

好的,首先剑道数据源没有可分页的网格,数据源有pagesize。现在谈谈你的问题,是的,你可以。使用sort参数

$("#grid").kendoGrid({
        dataSource: {
            data: setData(),
            pageSize: 10,
            sort: { field: "TotalScore", dir: "desc" }
        },
        scrollable: true,
        sortable: true,
        selectable: true,
        pageable: false,
        columns: [
            { field: "Name", title: "Name", width: 230" },
            { field: "Sex", title: "Sex", width: 50},
            { field: "Ca", title: "C.A." , width: 55},
            { field: "TotalScore", title: "Total Score", width: 100},
            { field: "Rank", title: "Rank", width: 60 }
        ]
    });
查看剑道文档了解更多信息