我刚开始使用Kendo和Angular,并且尝试使用带有SQL数据库的Scheduler。问题是,当一个新条目被添加到调度器中时,我可以看到条目最初是在UI中创建的(在新的事件窗口后面),但是当单击"Save“事件时,它成功地保存在数据库中,但是条目已不在UI中,我看到的唯一方法是重新加载丢失当前视图设置的数据。
我是在做/不做一些愚蠢的事情,还是有一种方法可以显示新事件而不对数据进行另一次完整的读取?
var schedSource = new kendo.data.SchedulerDataSource({
schema: {
model: {
id:"taskId",
fields: {
taskId: {
from: "id",
type: "number"
},
start: { type: "date", from: "start" },
end: { type: "date", from: "end" },
title: { from: "title", defaultValue: "No title", validation: { required: true } },
}
}
},
transport: {
read: {
url: '/sched',
dataType: 'json',
cache: false
},
update : {
url: '/sched/update',
dataType: 'json'
},
create: {
url: '/schedCreate',
dataType: "json"
},
destroy: {
url: '/schedDelete',
dataType: "json"
},
parameterMap: function (options, operation) {
if (operation != "read") {
var d = new Date(options.start);
options.start = kendo.toString(new Date(d), "yyyy-MM-ddTHH:mm:ss");
console.log(options.start);
var d = new Date(options.end);
options.end = kendo.toString(new Date(d), "yyyy-MM-ddTHH:mm:ss");
}
},
},
});
$scope.schOptions.dataSource = schedSource;对调度程序使用k选项
<body ng-controller="schedulCtrl">
<div kendo-scheduler k-date="today" k-options="schOptions"></div>
</body>发布于 2015-10-21 11:34:39
这在Scheduler故障排除帮助文章中列出(原因是服务没有返回创建的记录):
https://stackoverflow.com/questions/21043608
复制相似问题