Kendo UI Grid using Knockout and OData export data
I have a kendogrid in a custom widget defined that is binding to a div using knockout and using the Transport as OData returning json.
I am trying to get the data out of the grid to use to export it. I cannot seem to find the way to get that data out.
Is there a way using Jquery to do this?
I've tried the following:
$("#grid").data("kendoGrid");
$("#grid").data().kendoGrid.dataSource.view()
both give me undefined. from the data function
Seems like there should be a way to get to it using the observable
Here is the part of my definition :
<div data-bind="kendoGrid:
data: undefined,
autoBind: false,
dataSource:
type: 'odata',
transport:
read:
url: userSecurityUrl + '/AccountGroups',
dataType: 'json'
,
.........
</div>
I figured it out ..
Changed the knockout in my js file to be
var cagListDataSource = new kendo.data.DataSource(
type: 'odata',
transport:
read:
url: window.userSecurityUrl + '/AccountGroups',
dataType: 'json'
,
schema:
data: function (response)
self.gridIsInCallbackMode(false);
return response.Items;
,
total: function (response)
return response.Count;
,
serverSorting: true,
serverPaging: true,
serverFiltering: true,
pageSize:10
);
self.cagList = ko.observable(cagListDataSource);
Then set the dataSource in the grid to simply cagList
this worked.