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

javascript, jquery, json, kendo-grid, kendo-ui

Solution

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!

Problem

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 following, ``` var grid = $("#grid").data("kendoGrid"); alert(grid.dataSource.data.json); // I could dig through grid.dataSource.data and I see a function ( .json doen't exist I put it there so you know what i want to achieve ) ``` Thanks any help is greatly appreciated!

Original source