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

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


I think you're looking for

var displayedData = $("#YourGrid").data().kendoGrid.dataSource.view()

Then stringify it as follows:

var displayedDataAsJSON = JSON.stringify(displayedData);

Hope this helps!


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.


To get count of all rows in grid

$('#YourGridName').data("kendoGrid").dataSource.total()

To get specific row items

$('#YourGridName').data("kendoGrid").dataSource.data()[1]

To get all rows in grid

$('#YourGridName').data("kendoGrid").dataSource.data()

Json to all rows in grid

JSON.stringify($('#YourGridName').data("kendoGrid").dataSource.data())