Kendo UI 调度程序和 ASP.NET MVC

Kendo UI Scheduler and ASP.NET MVC

正在尝试 Kendo UI 使用 ASP.NET MVC。 我可以使用现成的工具包,但它会将前端与后端联系起来;那是不合适的,所以我正在手动完成所有操作。 我绑定了数据源

dataSource: {
                batch: true,
                transport: {
                    read: {
                        url: "http://192.168.0.34/FRINGE/api/tasks",
                        dataType: "json"
                    },

修改后的架构

schema: {
    model: {
        id: "TaskID",
        fields: {
            taskId: { from: "TaskID", type: "number" },
            title: { from: "Title", defaultValue: "No title", validation: { required: true } },
            start: { type: "date", from: "Start" },
            end: { type: "date", from: "End" },
            description: { from: "Description" },
            ownerId: { from: "OwnerID", defaultValue: 1 },
            isAllDay: { type: "boolean", from: "IsAllDay" }
        }
    },
    parse: function (responce) { /*debugger;*/ }
},

并写了一个简单的控制器

[HttpGet]
public ActionResult Tasks(int? id)
{
    //«data» type is List<Tasks>
    if (id.HasValue) 
        return Json(data.SingleOrDefault(x => x.TaskID == id.Value), JsonRequestBehavior.AllowGet);
    else 
        return Json(data, JsonRequestBehavior.AllowGet);
}

生成的数据类似于

[{"TaskID":1,"Title":"Action","Start":"\/Date(1425009600000)\/","End":"\/Date(1425013200000)\/","Description":"Action time","OwnerId":1,"IsAllDay":false},{"TaskID":2,"Title":"Dinner","Start":"\/Date(1425034800000)\/","End":"\/Date(1425038400000)\/","Description":"Dinner time","OwnerId":1,"IsAllDay":false}]

但没有任何效果。检查了 Telerik Kendo UI Dojo 上的架构和数据,一切都很好。我认为,由于缺少某些参数,控制器声明出现问题。 我错过了什么?

您在架构中定义了一个什么都不做的 parse 方法。您必须删除它或从中删除 return 数据:

parse: function(response) {
  return response;
}