This is a migrated thread and some comments may be shown as answers.

Kendo Grid call

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Iulian
Top achievements
Rank 1
Iulian asked on 16 Dec 2013, 09:32 AM
Hi guys,

I would like to implement a export solution and so far I can't find a solution that would suit our needs

I looked on this 2 examples provided by the Kendo Support Team:
http://www.kendoui.com/code-library/mvc/grid/export-grid-to-excel.aspx
http://www.kendoui.com/blogs/teamblog/posts/13-03-12/exporting_the_kendo_ui_grid_data_to_excel.aspx

We are licensed Kendo UI Complete so we can't use this solution:
http://www.kendoui.com/code-library/mvc/grid/export-grid-to-excel.aspx

This solution actually sends all the export data to the server (and to us that is not acceptable):
http://www.kendoui.com/blogs/teamblog/posts/13-03-12/exporting_the_kendo_ui_grid_data_to_excel.aspx

What we would really like is to define a new button on the grid header and to make a call to a WebApi specifying a different Http Verb or a different call parameter.
The main problem that we currently face is how to convert the filters / paging to an Odata Query String:

We tried something like this:
kendo.data.transports["odata"].parameterMap($("#grid").data("kendoGrid").dataSource._filter, 'json')
But this serialization does not provide the required result -  the filters formatted as an odata querystring. Eg:
"{"filters":[{"field":"Code","operator":"contains","value":"f"}],"logic":"and"}"
So could you please tell us how to serialize the datasource (filters, sort, etc.) as an odata querystring ?

**sorry about the thread name - i don't know how to change it to Kendo Grid Export

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Dec 2013, 07:59 AM
Hello,

The correct syntax would be like this:

var odata = kendo.data.transports["odata"].parameterMap({
  filter: $("#grid").data("kendoGrid").dataSource.filter(),
   sort: $("#grid").data("kendoGrid").dataSource.sort()
});

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Iulian
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or