1
votes

I have a kendo UI scheduler that makes a ajax call and receives 2 json records through the read method. This is my scheduler widget.

$("#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"}                                       

                    }
                }
            }
            }
            })

I have 2 problems

  1. the problem is that the records are not displayed on the scheduler
  2. When i un-comment out my custom properties in the schema design the code when i compile the code it errors.

UPDAE The json server response looks like

"{\"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}"
How does the server response look like? - Atanas Korchev
updated post to include json response - ChampChris
Your server response does bring up the model, the only thing is the data is coming up for 30th March. Regarding you Schema you can remove all the custom fields and just have ID and Title which will do for your scheduler: model: { id: "AppointmentId", fields: { title: { from: "Title", defaultValue: "No title", validation: { required: true } } } } - D_Learning
yeah there are 2 records one for the 30th and one for the 31st. I removed the extra fields and that didnt work either. - ChampChris
There is an error coming up about the loading image so im going fix that and see if that is causing the issue - ChampChris