So, I'm trying to see if OData will make the performance a little quicker. At first I had Odata v5 but, as far as I know, the Grid only works with v4 so I downgraded. Working with v4 reduced the number of javascript errors coming back.
However, now I'm stuck. Basically, I get "The query parameter '$count' is not supported.". I know the API works if I take out count and run the URL through POSTMAN.
Can someone help me out?
Here's my grid:
@(Html.Kendo().Grid<
vNPISearch
>()
.Name("npi-grid")
.Columns(columns =>
{
columns.Template(x => { }).ClientTemplate("#=GetPecosStatus(PecosNPI) #").Width(50);
columns.Bound(x => x.ProviderFirstName).Title("First Name");
columns.Bound(x => x.ProviderLastName).Title("Last Name");
columns.Bound(x => x.ProviderBusinessLocationAddressCity).Title("City");
columns.Bound(x => x.ProviderBusinessLocationAddressState).Title("State");
columns.Bound(x => x.NPI).Title("NPI");
})
.DataSource(dataSource => dataSource
.Custom()
.Schema(sch =>
{
sch.Model(m =>
{
m.Id("NPI");
m.Field(f => f.NPI).Editable(false);
m.Field(f => f.ProviderFirstName).Editable(false);
m.Field(f => f.ProviderLastName).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressCity).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressState).Editable(false);
});
})
.Type("odata-v4")
.Transport(transport =>
{
transport.Read(read => read.Url("http://localhost:58242/api/PecosSearch/Search?id=" + Model.SearchTerm));
})
.PageSize(20)
.ServerPaging(true)
.ServerSorting(true)
.ServerFiltering(true)
)
.Scrollable(scr => scr.Height("auto"))
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
7 Answers, 1 is accepted
Make sure that you have followed the settings described in the pot below:
http://www.telerik.com/blogs/using-kendo-ui-with-mvc4-webapi-odata-and-ef
Also try to implement custom transport.parameterMap,schema.data and schema.total. as shown below:
http://jsfiddle.net/TGwNm/
and see how it goes.
Regards,
Maria Ilieva
Telerik by Progress

Thank you for the examples, is there any way you could show me how to use this in MVC? I tried that Javascript way, but in the read parameter, it wasn't able to "see" the Model.SearchTerm. So that doesn't seem to work.
I changed my MVC grid to the following, I wasn't able to figure out how to add the parameter type function. Additionally, as soon as I open the page it starts the grid with the AJAX "loading" image. And it throws the error: Uncaught TypeError: Cannot read property '__count' of undefined
Also, just out of curiosity, if we were to purchase this, will the support turnaround be 3-4 days? Honestly right now I'm a little peeved at how long the response time is and that examples you show seem to be a "standard" response. IE: my examples are in MVC and you provide examples in straight up JS.
Anyway, I'm looking forward to a hopefully helpful response.
@(Html.Kendo().Grid<
vNPISearch
>()
.Name("npi-grid")
.Columns(columns =>
{
columns.Template(x => { }).ClientTemplate("#=GetPecosStatus(PecosNPI) #").Width(50);
columns.Bound(x => x.ProviderFirstName).Title("First Name");
columns.Bound(x => x.ProviderLastName).Title("Last Name");
columns.Bound(x => x.ProviderBusinessLocationAddressCity).Title("City");
columns.Bound(x => x.ProviderBusinessLocationAddressState).Title("State");
columns.Bound(x => x.NPI).Title("NPI");
})
.DataSource(dataSource => dataSource
.Custom()
.Schema(sch =>
{
sch.Model(m =>
{
m.Id("NPI");
m.Field(f => f.NPI).Editable(false);
m.Field(f => f.ProviderFirstName).Editable(false);
m.Field(f => f.ProviderLastName).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressCity).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressState).Editable(false);
});
})
.Type("odata")
.Transport(transport =>
{
transport.Read(read =>
{
read.Url("http://localhost:58242/api/PecosSearch/Search?id=" + Model.SearchTerm);
read.DataType("json");
});
})
.PageSize(20)
.ServerPaging(true)
.ServerSorting(true)
.ServerFiltering(true)
)
.Scrollable(scr => scr.Height("auto"))
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)

Can you please provide an example in MVC? Also, if we were to become a customer, should I expect a 3-4 day turn around? Additionally, I'm a little peeved that responses from support seem awfully "standard" and not customized to my particular question. Like in this thread, I'm clearly using MVC but you provide examples of JS. I couldn't figure out how to add the parameterMap to the transport...
I made some changes to the gird to the following:
@(Html.Kendo().Grid<
vNPISearch
>()
.Name("npi-grid")
.Columns(columns =>
{
columns.Template(x => { }).ClientTemplate("#=GetPecosStatus(PecosNPI) #").Width(50);
columns.Bound(x => x.ProviderFirstName).Title("First Name");
columns.Bound(x => x.ProviderLastName).Title("Last Name");
columns.Bound(x => x.ProviderBusinessLocationAddressCity).Title("City");
columns.Bound(x => x.ProviderBusinessLocationAddressState).Title("State");
columns.Bound(x => x.NPI).Title("NPI");
})
.DataSource(dataSource => dataSource
.Custom()
.Schema(sch =>
{
sch.Model(m =>
{
m.Id("NPI");
m.Field(f => f.NPI).Editable(false);
m.Field(f => f.ProviderFirstName).Editable(false);
m.Field(f => f.ProviderLastName).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressCity).Editable(false);
m.Field(f => f.ProviderBusinessLocationAddressState).Editable(false);
});
})
.Type("odata")
.Transport(transport =>
{
transport.Read(read =>
{
read.Url("http://localhost:58242/api/PecosSearch/Search?id=" + Model.SearchTerm);
read.DataType("json");
});
})
.PageSize(20)
.ServerPaging(true)
.ServerSorting(true)
.ServerFiltering(true)
)
.Scrollable(scr => scr.Height("auto"))
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)

Also, as soon as I go to the page, it starts trying to load data. Additionally, I get the following error:
Uncaught TypeError: Cannot read property '__count' of undefined
Excuse us for the delay on this reply. Note that the forum threads has 48 hours response time, however in case you are licensed customer you can open official support tickets that guarantee response within 24 hours.
As for the scenario you have note that the wrappers use a specially tailored, predefined parameterMap in order to support ASP.NET MVC out of the box. Using your own will break this support and for this reason there is no mechanism for building custom parameterMap functions.
You can try to call the default aspnetmvc-ajax parameterMap implementation in your own paramterMap similar to the following:
var
result = kendo.data.transports[
"aspnetmvc-ajax"
].prototype.options.parameterMap.call(
this
, options, type);
However I note that the officially supported way to send additional data with the wrappers is documented here.
Also you can revise the applictaion provided below, as I suppose it will fit to your requirements:https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/odata-v4-web-api-binding-wrappers
Regards,
Maria Ilieva
Telerik by Progress

I looked at the documentation and believe I've copied it right, but I get a 404 error when I try to run the query through Postman.
Checkout the code posted here: https://gist.github.com/ajtatum/caa51247760f06be8f4d5a2f8083edc5
I revise the provided code and based on that:
builder.EntitySet<
Pecos
>("Pecos");
the end point should be:
http://localhost:58242/odata/Pecos
Also note that, when you are registering
odata
route in web-api configuration, it must be placed before all other routes. See the topic below:http://tech.trailmax.info/2014/02/odata-controllers-in-webapi-2-1-getting-404-page-not-found/
I hope this helps.
Regards,
Maria Ilieva
Telerik by Progress