0

我有一个甘特图,当我移动或更改开始/结束日期时,会更新数据库,但不会保留在甘特图上。我必须重新加载甘特图才能看到变化。有没有办法扩展更新事件以在更新后刷新?

$("#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
                                        }
                                    }
                                }
                            }
4

1 回答 1

0

我遇到的问题(我在 KendoUI 网站文档的任何地方都找不到提到它!)是您需要在更新后返回更新的数据行。返回它会启动该特定行的刷新并保留移动/更新

除此之外,我唯一改变的是在读取和更新时将传输方法从 JSON 更改为 JSONP。

于 2016-06-06T10:23:37.953 回答