您如何设置数据函数的剑道数据源使用剃刀HTML助手?剑道、剃刀、数据源、函数

2023-09-06 10:29:45 作者:久违伊人容

我试图让剑道UI为ASP.NET MVC的网格控件使用OData的查询时的WebAPI控制器的工作。我想preFER使用HTML助手发出相应的JavaScript,但我挣扎,发出这样的等价的:

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; }))

但我发现了

错误:剑道未定义

在IE浏览器和发射实际的JS是:

in IE and the actual JS emitted is:

"schema":{"data":Kendo.Mvc.ClientHandlerDescriptor}

什么是做这种正确的方法是什么?

What is the correct way to do this?

推荐答案

一个有点困难,没有完全code调试您的问题,但它可能应该是这样的:

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")))
 
精彩推荐