Данные SharePoint не отображаются в планировщике кендо - PullRequest
0 голосов
/ 20 ноября 2018

Данные извлекаются с помощью вызова REST в моем транспорте, но событие не отображается в планировщике Kendo.Меня интересует только отображение данных на данный момент, обновление не работает

    $("#scheduler").kendoScheduler({
    date: new Date("2018/11/11"),
    startTime: new Date("2018/11/11 07:00 AM"),
    height: 600,
    views: [
        "day",
        "workWeek",
        "week",
        { type: "month", selected: true },
        "agenda",
        { type: "timeline", eventHeight: 50}
    ],
    add: function (e) {
    },
    change: function (e) {
    },
    error: function (e) {

        //TODO: handle the errors

        alert(e.errorThrown);

    },
    dataSource: {
        transport: {
            read: {
                url: "https://SharePoint URL/apps/crp/_api/web/lists/getbytitle('list name')/items?$expand=Author&$select=Author/Id,Author/Title,Title,Start1,OData__x0045_nd1,RecurrenceRule,RecurrenceParentID,CategoryDescription,IsAllDay&$filter=Start1 ge datetime'2018-11-01T00:00:00Z'",
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("Accept", "application/json; odata=verbose");
                }
            },
            add: function (e) {
            },
            error: function (e) {
                //TODO: handle the errors
                alert(e.errorThrown);
            },
            update:
                {
                    url: function (data) {
                        alert('updating');
                        return "https://SharePoint URL/_api/web/lists/getbytitle(listname)/items" + "(" + data.ID + ")";
                    },
                    type: "POST",
                    dataType: "json",
                    contentType: "application/json;odata=verbose",
                    headers: {
                        "accept": "application/json;odata=verbose",
                        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                        "If-Match": "*",
                        "X-HTTP-Method": "MERGE",
                    },
                },
            parameterMap: function (data, type) {
                if (data.models) {
                    alert(kendo.stringify(data.models));
                    return {
                        models: kendo.stringify(data.models)
                    }
                }
            }
        },
        schema: {
            model: {
                id: "ID",
                fields: {
                    ID: { from: "ID", type: "number" },
                    title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                    start: { type: "date", from: "Start1" },
                    end: { type: "date", from: "OData__x0045_nd1" },
                    recurrenceRule: { from: "RecurrenceRule" },
                    recurrenceId: { from: "RecurrenceParentID", type: "number" },
                    description: { from: "CategoryDescription" },
                    isAllDay: { type: "boolean", from: "IsAllDay" } //,
                }
            }
        }
    }
});

При просмотре вызова JSON данные извлекаются правильно, но не отображаются в планировщике.Я попытался захватить события в источнике данных, который не выглядит так, как будто он обрабатывается, поэтому источник данных, похоже, не заполняет (не изменяет или не добавляет события).

Возвращенные данные выглядят так после вызова JSON:

"{\" д \ ": {\" \ "результаты: [{\" __ метаданных \ ": {\" идентификатор \ ": \" Web / Списки (guid'2abecf66-35ed-4c67-b1f1-8b7255ebf0e2') / Items (1) \ ", \" uri \ ": \" https://SharePoint url / _api / Web / Lists (guid'2abecf66-35ed-4c67-b1f1-8b7255ebf0e2') / Items (1)\», \ "ETag \": \ "\\" \\ 4 "\", \ "Тип \": \ "SP.Data.6001C5110ListItem \"}, \ "Автор \": {\ "__ метаданных \": {\ "ID \": \ "43c25e84-bf91-4d7d-951f-c480d9b2173f \", \ "типа \": \ "SP.Data.UserInfoItem \"}, \ "Id \": 5, \ "Название\ ": \" SP USer \ "}, \" Title \ ": \" 6001-C5-110 \ ", \" Start1 \ ": \" 2018-11-14T15: 00: 00Z \ ", \" OData__x0045_nd1\ ": \" 2018-11-14T17: 00: 00Z \ ", \" RecurrenceRule \ ": null, \" RecurrenceParentID \ ": null, \" CategoryDescription \ ": \" Мое описание \ ", \" IsAllDay \ "": нулевая}]}}"

1 Ответ

0 голосов
/ 21 ноября 2018

Добавлены данные: в раздел схемы источника данных, спасибо, Сандун, за то, что указал мне правильное направление, я определил модель для планировщика без указания данных.

        schema: {
            data: function (data) {
                return data.d && data.d.results ? data.d.results : [data.d];
            },
            model: {
                id: "ID",
                fields: {
                    ID: { from: "ID", type: "number" },
                    title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                    start: { type: "date", from: "Start1" },
                    end: { type: "date", from: "OData__x0045_nd1" },
                    recurrenceRule: { from: "RecurrenceRule" },
                    recurrenceId: { from: "RecurrenceParentID", type: "number" },
                    description: { from: "CategoryDescription" },
                    isAllDay: { type: "boolean", from: "IsAllDay" } //,
                    // startTimeZone: "Etc/UTC",
                    // endTimeZone: "Etc/UTC"
                    // description: { from: "Description" } 
                }
            }
        }
...