3

我在显示 KendoUI 调度程序数据(调度程序事件或您想调用的任何内容)时遇到了一些困难。调用是在数据进入时进行的,但它不显示它,也不会导致任何错误。我已经粘贴了代码和响应,希望有人知道我做错了什么。

是的,我一直在 json/jsonp 作为数据类型和批处理在所有可能的组合中设置为 true 和 false 之间切换。

编码:

  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;

响应:

[
{
"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"
}
]
4

2 回答 2

2

我在没有错误的情况下遇到了同样的问题。修复它的是(愚蠢但)我正在设置开始和结束时区,即。task.setEndTimezone(TimeZone.getTimeZone("UTC"));,只需将它们设置为空,而时区仍设置在任务返回的开始和结束日期时间中。希望这可以帮助。

于 2014-01-06T21:58:03.750 回答
1

我在使用 Firefox 调试时看到“ReferenceError: convertDate is not defined”...

dtFrom: convertDate($("#calendar").data("kendoScheduler").view().startDate()), dtUntil: convertDate($("#calendar").data("kendoScheduler").view() 。结束日期()),

您可能需要确保包含所有适当的 .js 文件

于 2013-09-23T15:24:00.053 回答