Pergunta

I'm having a bit of difficulty with KendoUI Scheduler data(scheduler events or whatever you want to call them) display. The call is made amd the data comes in but it doesn't display it, nor does it cause any errors. I've pasted the code and responce, hoping that someone knows what I'm doing wrong.

And yes I've been switching between json/jsonp as the datatype and batch set to true and false in all possible combinations.

The Code:

  var my_dataSource;

    $("#calendar").kendoScheduler({
        height: "650px",
        timezone: "Etc/UTC",
        views: [
            "day",
            "week",
            { type: "month", selected: true },
            "agenda"
        ]
    });

    my_dataSource = new kendo.data.SchedulerDataSource({
        transport: {
            read: {
                url: "ashx/Calendar/GetCalendarData.ashx",
                cache: false,
                data: {
                    dtFrom: convertDate($("#calendar").data("kendoScheduler").view().startDate()),
                    dtUntil: convertDate($("#calendar").data("kendoScheduler").view().endDate()),
                    DateInterval: "month",
                    dateIntervalSteps: "1",
                    Categories: ""
                },
                dataType: "jsonp"
            },
            batch: true,
            parameterMap: function (options, operation) {
                //console.log(JSON.stringify(options));
                return options;
            }
        },
        schema: {
            data: "Data",
            model: {
                id: "taskID",
                fields: {
                    taskID: { from: "id", type: "number" },
                    title: { from: "summary", defaultValue: "No title", validation: { required: false } },
                    start: { type: "date", from: "startTime" },
                    end: { type: "date", from: "endTime" },
                    //startTimezone: { from: "StartTimezone" },
                    //endTimezone: { from: "EndTimezone" },
                    //description: { from: "Description" },
                    //recurrenceId: { from: "RecurrenceID" },
                    //recurrenceRule: { from: "RecurrenceRule" },
                    //recurrenceException: { from: "RecurrenceException" },
                    ownerId: { from: "eOwnerId", defaultValue: 1 },
                    isAllDay: { type: "boolean", from: "allDay" }
                }
            }
        }
    });

    var cal = $("#calendar").data("kendoScheduler");
    cal.dataSource = my_dataSource;

The Response:

[
{
"id": 329837,
"summary": "Lorem Ipsum",
"startTime": "Date(1375862400)",
"endTime": "Date(1377273600)",
"allDay": true,
"calendar": "cat10001",
"eOwnerId": 1569,
"Title": "Project Meeting"
},
{
"id": 334664,
"summary": "Lorem Ipsum",
"startTime": "Date(1376985600)",
"endTime": "Date(1376989200)",
"allDay": false,
"calendar": "cat10002",
"eOwnerId": 130,
"Title": "Meeting"
},
{
"id": 334659,
"summary": "Lorem Ipsum",
"startTime": "Date(1377007200)",
"endTime": "Date(1377010800)",
"allDay": false,
"calendar": "cat10003",
"eOwnerId": 1810,
"Title": "Task"
}
]
Foi útil?

Solução

I had a the same problem while getting no errors. What fixed it was (silly but) i was setting the start and end timezones ie. task.setEndTimezone(TimeZone.getTimeZone("UTC"));, just set them to null while timezone is still set in the returned start and end datetime of the task. Hope this helps.

Outras dicas

I see "ReferenceError: convertDate is not defined" when using Firefox debugging...

dtFrom: convertDate($("#calendar").data("kendoScheduler").view().startDate()), dtUntil: convertDate($("#calendar").data("kendoScheduler").view().endDate()),

You may want to make sure you are including all of the appropriate .js files

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top