Kendo UI调度程序不显示json数据

时间:2014-04-02 01:52:24

标签: kendo-ui jsonp kendo-mobile kendo-scheduler

我有一个kendo UI调度程序,它通过read方法进行ajax调用并接收2个json记录。这是我的调度程序小部件。

$("#scheduler").kendoScheduler({
            date: new Date(),
            startTime:time ,
            height: kendo.support.mobileOS.wp ? "28em" : 600,
            views: [
                { type: "day", selected: true },
                { type: "week", selectedDateFormat: "{0:ddd,MMM dd,yyyy} - {1:ddd,MMM dd,yyyy}" },
                "month",
                { type: "agenda", selectedDateFormat: "{0:ddd, M/dd/yyyy} - {1:ddd, M/dd/yyyy}" },
            ],
            mobile: "phone",
            datasource:{
                batch: true,
                transport: {
                    read: {
                        url: "http://mydomain.com/api/Schedule/Tasks_Read",
                        dataType: "jsonp"
                    },
                    update: {
                        url: "http://demos.telerik.com/kendo-ui/service/meetings/update",
                        dataType: "jsonp"
                    },
                    create: {
                        url: "http://demos.telerik.com/kendo-ui/service/meetings/create",
                        dataType: "jsonp"
                    },
                    destroy: {
                        url: "http://demos.telerik.com/kendo-ui/service/meetings/destroy",
                        dataType: "jsonp"
                    },
                    parameterMap: function(options, operation) {
                        if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                        }
                    }
                },    
        schema: {
            data:"Data",
            model: {
                id: "AppointmentId",
                fields: {
                    //meetingID: { from: "MeetingID", type: "number" },
                    title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                    start: { type: "date", from: "Start" },
                    end: { type: "date", from: "End" },
                    startTimezone: { from: "StartTimezone" },
                    endTimezone: { from: "EndTimezone" },
                    description: { from: "Description" },
                    //recurrenceId: { from: "RecurrenceID" },
                    recurrenceRule: { from: "RecurrenceRule" },
                    recurrenceException: { from: "RecurrenceException" },
                    //roomId: { from: "RoomID", nullable: true },
                    //atendees: { from: "Atendees", nullable: true },
                    isAllDay: { type: "boolean", from: "IsAllDay" },
                    //professionalId:{type:"string", from: "ProfessionalId", defaultValue=""},
                    //professionalName:{type:"string", from: "ProfessionalName"},
                    //clientId:{type:"string", from: "ClientId", defaultValue=""},
                    //clientName:{type:"string", from: "ClientName"}                                       

                    }
                }
            }
            }
            })

我有2个问题

  1. 问题是记录没有显示在调度程序
  2. 当我在架构设计中取消注释我的自定义属性时,编译代码时代码出错。
  3. UPDAE json服务器响应看起来像

    "{\"AppointmentId\":30,\"ClientId\":\"b26d9cc1-ddcc-4277-a4eb-61835c83fb48\",\"ClientName\":\"beast client\",\"ProfessionalId\":\"260f0c43-7ff9-4654-af2b-5df2f5b8d6a1\",\"ProfessionalName\":\"AutoFirstName AutoLastName\",\"Start\":\"2014-03-30T07:00:00\",\"End\":\"2014-03-30T07:30:00\",\"ColorUsed\":null,\"HairStyleId\":null,\"Title\":\"beast client Haircut                                                                                \",\"Description\":\"beast client Haircut\",\"InactiveReasonDate\":null,\"InactiveReasonId\":null,\"IsAllDay\":false,\"StartTimezone\":null,\"EndTimezone\":null,\"RecurrenceRule\":null,\"RecurrenceException\":null,\"ClientRating\":null},{\"AppointmentId\":31,\"ClientId\":\"b26d9cc1-ddcc-4277-a4eb-61835c83fb48\",\"ClientName\":\"beast client\",\"ProfessionalId\":\"260f0c43-7ff9-4654-af2b-5df2f5b8d6a1\",\"ProfessionalName\":\"AutoFirstName AutoLastName\",\"Start\":\"2014-03-31T07:00:00\",\"End\":\"2014-03-31T07:30:00\",\"ColorUsed\":null,\"HairStyleId\":null,\"Title\":\"beast client Haircut\",\"Description\":\"beast client Haircut                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \",\"InactiveReasonDate\":null,\"InactiveReasonId\":null,\"IsAllDay\":false,\"StartTimezone\":null,\"EndTimezone\":null,\"RecurrenceRule\":null,\"RecurrenceException\":null,\"ClientRating\":null}"
    

0 个答案:

没有答案