对KendoGrid数据源进行排序。

编程入门 行业动态 更新时间:2024-10-12 14:18:24
本文介绍了对KendoGrid数据源进行排序。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 我有一个像剑道网格一样的要求,我必须做两件事 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数据源进行排序。

本文发布于:2023-07-09 21:24:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1088246.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据源   KendoGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!