Kendo UI更新后刷新甘特图
Kendo UI Gantt refresh after update
我有一个甘特图,当我移动或更改日期 start/end 时,它会更新数据库但不会保留在甘特图中。我必须重新加载甘特图才能看到变化。有没有办法将更新事件扩展到更新后刷新?
$("#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
}
}
}
}
我遇到的问题(我无法在 KendoUI 网站文档的任何地方找到它!)是您需要在更新后 return 更新的数据行。返回它会启动该特定行的刷新并保留 move/update
除此之外我唯一改变的是在读取和更新时将传输方法从 JSON 更改为 JSONP。
我有一个甘特图,当我移动或更改日期 start/end 时,它会更新数据库但不会保留在甘特图中。我必须重新加载甘特图才能看到变化。有没有办法将更新事件扩展到更新后刷新?
$("#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
}
}
}
}
我遇到的问题(我无法在 KendoUI 网站文档的任何地方找到它!)是您需要在更新后 return 更新的数据行。返回它会启动该特定行的刷新并保留 move/update
除此之外我唯一改变的是在读取和更新时将传输方法从 JSON 更改为 JSONP。