How to get the displayed data of KendoGrid in json format?

后端 未结 5 1952
北海茫月
北海茫月 2020-12-28 13:45

I have a kendoGrid and i would like to get the JSON out of it after filtering and sorting how do I achieve this?

something like the followi

5条回答
  •  渐次进展
    2020-12-28 14:17

    If you want to get all pages of the filtered data you can use this:

    var dataSource = $("#grid").data("kendoGrid").dataSource;
    var filters = dataSource.filter();
    var allData = dataSource.data();
    var query = new kendo.data.Query(allData);
    var data = query.filter(filters).data;
    

    Make sure to check if filters exist before trying to apply them or Kendo will complain.

提交回复
热议问题