Kendo 调度程序数据源未刷新
Kendo Scheduler datasource not Refresh
我创建了一个实现 Kendo 调度程序的 mvc 应用程序...
问题:我有一个 ajax 调用 returns 新数据来填充数据源的按钮,但我无法再次填充数据源 ...
有人可以帮助我吗?
按照我做的代码
$.ajax({
url: '@Url.Action("Action", "Controller")',
type: "POST",
data: { 'checados': checked },
dataType: "jsonp",
cache: false,
success: function (results) {
var result = [];
var event;
for (var i = 0; i < results.length; i++) {
event = results[i];
result.push(new kendo.data.SchedulerEvent({
id: event.ID,
title: event.Title,
description: event.Description,
start: kendo.parseDate(event.Start),
end: kendo.parseDate(event.End),
isAllDay: event.IsAllDay,
recurrenceException: event.RecurrenceException,
recurrenceId: event.RecurrenceId,
recurrenceRule: event.RecurrenceRule,
resource: event.Resource,
}));
}
var resource = sch.resources[0];
resource.dataSource.read();
sch.setDataSource(result);
sch.refresh();
},
error: function () {
alert('Error occured');
}
});
我创建了一个实现 Kendo 调度程序的 mvc 应用程序... 问题:我有一个 ajax 调用 returns 新数据来填充数据源的按钮,但我无法再次填充数据源 ...
有人可以帮助我吗?
按照我做的代码
$.ajax({
url: '@Url.Action("Action", "Controller")',
type: "POST",
data: { 'checados': checked },
dataType: "jsonp",
cache: false,
success: function (results) {
var result = [];
var event;
for (var i = 0; i < results.length; i++) {
event = results[i];
result.push(new kendo.data.SchedulerEvent({
id: event.ID,
title: event.Title,
description: event.Description,
start: kendo.parseDate(event.Start),
end: kendo.parseDate(event.End),
isAllDay: event.IsAllDay,
recurrenceException: event.RecurrenceException,
recurrenceId: event.RecurrenceId,
recurrenceRule: event.RecurrenceRule,
resource: event.Resource,
}));
}
var resource = sch.resources[0];
resource.dataSource.read();
sch.setDataSource(result);
sch.refresh();
},
error: function () {
alert('Error occured');
}
});