We know the Web API doesn't support all oData specs but supports enough to implement paging, filtering and sorting.
* Project is written in VS11 and .NET 4.5
8 Answers, 1 is accepted
The "odata" type of DataSource should be used only with full implementations of OData. Web API is not OData and returns JSON in different format than the one returned by an OData service. The Kendo DataSource expects valid OData response in order to work.
If you want to use the odata parameter map to translate the current filter, page and sort expressions to OData format you can check this forum thread.
Perhaps in the long term a new type of data source "webapi" would be introduced which would support the response from Web API.
On a side note WebAPI does not seem to currently support $inlinecount which effectively disables any paging support.
Atanas Korchev
the Telerik team
Either way, this demo was modeled after this blog post by Stephen Walter:
http://stephenwalther.com/blog/archive/2012/03/05/introduction-to-the-asp-net-web-api.aspx
He mentions at the bottom using $top and $skip to implement paging. I'll play with it more when I have time. Thanks for pointing out to this paramterMap override thread. I was looking at the parameterMap last night myself but was too tired to dissect parameters last night.
Adding a 'webapi' type to the DataSource though would be a great solution if you can get basic paging, sorting and filtering working. Even if there are limitations, if the core stuff works, I think this will be great in the end. It'll make building apps with Kendo and Web API so easy and fast. Well other than trying to use it as odata source, everything else works fine when treating it as plain JSON. If we can implement paging, filtering and sorting using some generic way using parameterMap override that should work too in the short term.
The recommended way to proceed is to open a new user voice item for this.
Kind regards,Atanas Korchev
the Telerik team
Currently the datasource has no notion of response and request formats. The only specialized kind of data source is OData.
I think what you need can be achieved even now bu using the odata parameter map:
dataSource:{
transport: {
read: {
dataType:
"json"
},
parameterMap: kendo.data.transports.odata.parameterMap
}
}
Regards,
Atanas Korchev
the Telerik team