【发布时间】:2018-10-19 10:09:26
【问题描述】:
我想知道是否有一种简单的方法可以将 Kendo Angular Grid 绑定到 ASP.NET Core OData 控制器。我说的容易是什么意思?
好吧,在 jQuery 的 Kendo UI 中,我们需要做的就是在 DataSource 对象中指定“类型”和“传输”属性;参考:https://demos.telerik.com/kendo-ui/grid/odatav4
同样适用于 ASP.NET MVC 的 Kendo;参考:https://demos.telerik.com/aspnet-mvc/grid/odata
但是,我认为我已经阅读了整个文档,并且找不到以类似方式将 OData 服务与 Kendo Angular Grid 绑定的方法。
此页面包含有关网格数据绑定的一些信息:https://www.telerik.com/kendo-angular-ui/components/grid/data-binding/ ...但是,公开 ProductService 类的“northwind.service.ts”文件包含两个方法,看起来它们执行某种“硬编码”OData 过滤。
在“与 ASP.NET Core 的 UI 集成”页面 (https://www.telerik.com/kendo-angular-ui/components/dataquery/mvc-integration/) 中,有一个指向该项目的链接:https://github.com/telerik/kendo-angular-demo-aspnetcore-data/tree/master,但是作为后端的 ASP.NET Core Controller 不是基于 ODataController 和而是返回 JsonResult。也许有一种方法可以更改后端实现,但是我不确定使用提供的客户端代码是否一切都能正常工作。
我还发现了这个 GitHub 存储库:https://github.com/urfnet/URF.Core.Sample,它看起来很有前途,有一个专用的“服务”似乎可以处理所有 http 操作(GET、POST、PUT..)并且看起来非常“可重用”。
我错过了什么还是没有简单的方法?我真的需要编写自己的服务来处理 Kendo Angular Grid 和 ASP.NET Core Odata 通信吗?
(我正在使用 ASP.NET Core 2、Angular 5、最新的 Kendo UI for Angular 和 OData 包,在本文中有所描述:https://blogs.msdn.microsoft.com/odatateam/2018/07/03/asp-net-core-odata-now-available/)
【问题讨论】:
标签: angular asp.net-core angular5 odata kendo-ui-angular2