问题
I'm trying to get the Kendo UI for ASP.NET MVC grid control working with a WebApi controller using OData queries. I would prefer to emit the relevant javascript using the Html helpers but I'm struggling to emit the equivalent of this:
schema: { data: function (data) { return data; } }
I've tried this:
.Schema(schema => schema.Data((object data) => { return data; }))
But I'm getting
Error: 'Kendo' is undefined
in IE and the actual JS emitted is:
"schema":{"data":Kendo.Mvc.ClientHandlerDescriptor}
What is the correct way to do this?
回答1:
A bit difficult to debug your issue without full code, but it should probably look like this:
.DataSource(dataSource => dataSource
.Custom()
.Schema(schema => schema.Data(data => data))
.Type("odata")
.Transport(t => t.Read("MyAction", "My")))
来源:https://stackoverflow.com/questions/29832460/how-do-you-set-the-data-function-for-a-kendo-datasource-using-the-razor-html-hel