Обновление Kendo UI Gantt после обновления
У меня есть диаграмма Ганта, которая при перемещении или изменении даты начала / конца обновляет базу данных, но не сохраняется на Ганта. Я должен перезагрузить Гант, чтобы увидеть изменения. Есть ли способ расширить событие обновления для обновления после обновления?
$("#gantt_here").kendoGantt({
dataSource: {
batch: true,
transport: {
read: {
url: "http://URL/gantt/<?= $client ?>/<?= $project ?>",
dataType: "json"
},
update: {
url: "http://URL/ganttUpdate/<?= $client ?>/<?= $project ?>",
dataType: "json",
method: "post"
},
create: {
url: "http://URL/<?= $client ?>/<?= $project ?>",
dataType: "json"
},
destroy: {
url: "http://URL/ganttDestroy/<?= $client ?>/<?= $project ?>",
dataType: "json"
},
parameterMap: function (options, operation) {
if (operation !== "read") {
return {models: kendo.stringify(options.models || [options])};
}
}
},
schema: {
model: {
id: "id",
fields: {
id: {from: "id", type: "number"}, //
orderId: {from: "orderId", type: "number", validation: {required: true}}, //
parentId: {from: "parent", type: "number", validation: {required: true}}, //
start: {from: "start", type: "date"}, //
end: {from: "end", type: "date"}, //
title: {from: "title", defaultValue: "", type: "string"}, //
percentComplete: {from: "percentComplete", type: "number"}, //
client: {from: "client", type: "number", validation: {required: true}}, //
project: {from: "project", type: "string", validation: {required: true}}, //
summary: true,
expanded: true
}
}
}
}
1 ответ
Решение
Проблема, с которой я столкнулся (и я не могу найти ее нигде в документации на веб-сайте KendoUI!) Заключается в том, что вам нужно возвращать обновленную строку данных после обновления. Возврат этого инициирует обновление этой конкретной строки и сохраняет перемещение / обновление
Единственное, что я изменил, кроме этого, это изменил метод транспорта с JSON на JSONP при чтении и обновлении.