我有一个甘特图,当我移动或更改日期开始/结束时,更新数据库但不会持续在甘特图上。我必须重新加载甘特以看到变化。有没有办法在更新后将更新事件扩展为刷新?
$("#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
}
}
}
}
答案 0 :(得分:0)
我遇到的问题(我在KendoUI网站上的任何地方都找不到它提到的文件!)是你需要在更新后返回更新的数据行。返回此操作将启动该特定行的刷新并保留移动/更新
我唯一改变的是在读取和更新时将传输方法从JSON更改为JSONP。