您如何设置数据函数的剑道数据源使用剃刀HTML助手? [英] How do you set the data function for a Kendo DataSource using the Razor HTML Helpers?

查看:104
本文介绍了您如何设置数据函数的剑道数据源使用剃刀HTML助手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让剑道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")))

这篇关于您如何设置数据函数的剑道数据源使用剃刀HTML助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆