你好, 我有一个像剑道网格一样的要求,我必须做两件事 1.获取KendoGrid数据。 2.获取数据源后,我必须对该数据源中的一些行进行排序。 我得到的数据源如
Hello, I have a requirement like I have on Kendo Grid and and I have to do two things with that 1.Getting KendoGrid datasorce. 2.After getting the datasource I have to sort some of the rows in that data source. I am getting the datasource like
var dataSource = $("#" + gridId).data().kendoGrid.dataSource.data();但是我无法按任何方式排序 我用以下过程来做这件事
but I am not able to sort it any way I have used the following process to do that
dataSource = new kendo.data.DataSource({ data: dataSource, sort: { field: "Column1", dir: "desc" } }); dataSource = dataSource.view();但这是最糟糕的尝试。 等待回复。 谢谢 Ipsita
But it was worst trying. Waiting for the reply. Thanks Ipsita
推荐答案( # + gridId).data()。kendoGrid .dataSource.data(); ("#" + gridId).data().kendoGrid.dataSource.data();
但是我无法按任何方式排序 我使用了以下过程来执行此操作
but I am not able to sort it any way I have used the following process to do that
dataSource = new kendo.data.DataSource({ data: dataSource, sort: { field: "Column1", dir: "desc" } }); dataSource = dataSource.view();但这是最糟糕的尝试。 等待回复。 谢谢 Ipsita
But it was worst trying. Waiting for the reply. Thanks Ipsita
我从网格上看到获取Kendo数据源的方式是这样的: The way I've seen to get a Kendo DataSource from a Grid is like this: var ds =
( #grid)。 data( kendoGrid)。dataSource; ("#grid").data("kendoGrid").dataSource;
一旦你在变量中有了DataSource,就可以在它上面运行.sort()并传入一个排序对象:
Once you have the DataSource in a variable, you can simple run .sort() on it and pass in a sort object:
ds.sort({ field: "fieldName", dir: "asc" });
更多推荐
对KendoGrid数据源进行排序。
发布评论