问题描述
我使用KendoUI调度与AngularJS。
我声明,根据文件,pretty标准的东西调度选项。见下图:
我想要做的是能更新 $ scope.schedulerOptions
,并使这些变化体现在UI。当我修改 $ scope.schedulerOptions
没有在用户界面的变化。
这是如何做到这一点任何想法?
$ scope.schedulerOptions = {
日期:新日期(2013年6月13日),
startTime时,新的日期(2013年6月13日07:00),
高度:600,
意见:
天,
{类型:工作周,选择:真},
周,
月,
]
eventTemplate:<跨度类='自定义事件'> {{dataItem.title}}< / SPAN>中,
allDayEventTemplate:< DIV CLASS ='定制全天事件'> {{dataItem.title}}< / DIV>中,
时区:ETC / UTC
数据源: {
批:真实,
运输: {
阅读:{
网址:http://demos.telerik.com/kendo-ui/service/tasks
数据类型:JSONP
},
更新:{
网址:http://demos.telerik.com/kendo-ui/service/tasks/update
键入:PUT
},
创建: {
网址:http://demos.telerik.com/kendo-ui/service/tasks/create
键入:POST
},
毁灭:{
网址:http://demos.telerik.com/kendo-ui/service/tasks/destroy
输入:删除
},
parameterMap的:功能(选择,操作){
如果(!==操作读和放大器;&安培; options.models){
返回{机型:kendo.stringify(options.models)};
}
}
},
模式:{
型号:{
ID:任务id
字段:{
TASKID:{从的TaskID,键入:数字},
标题:{来源:标题,设置defaultValue:无题,验证:{要求:真正}},
开始:{类型:日期,从开始},
结束:{类型:日期,从结束},
startTimezone:{从StartTimezone},
endTimezone:{从EndTimezone},
说明:{从说明},
recurrenceId:{从RecurrenceID},
recurrenceRule:{从RecurrenceRule},
recurrenceException:{从RecurrenceException},
OWNERID:{来源:OWNERID,设置defaultValue:1},
isAllDay:{类型:布尔,从IsAllDay}
}
}
},
过滤:{
逻辑:或
过滤器:
{场:OWNERID,经营者:情商,值:1},
{场:OWNERID,经营者:情商,值2}
]
}
},
资源:
{
现场:OWNERID
标题:所有者,
数据源: [
{文字:亚历克斯,价值:1,颜色:#f8a398},
{文字:鲍勃,值:2,颜色:#51a0ed},
{文字:查理,值:3,颜色:#56ca85}
]
}
]
};
据的可以初始化修改HTML后更改值< DIV剑道的调度程序=附表K-选项=选项 >< / DIV>
和附表访问作为模型变量 $ scope.sched.setOptions(...);
I am using KendoUI scheduler with AngularJS.
I am declaring the scheduler options in accordance with the documentation, pretty standard stuff. See below:
What I would like to do is be able to update $scope.schedulerOptions
and have those changes reflected in the UI. When I make changes to $scope.schedulerOptions
nothing changes in the UI.
Any ideas on how to do this?
$scope.schedulerOptions = {
date: new Date("2013/6/13"),
startTime: new Date("2013/6/13 07:00 AM"),
height: 600,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
],
eventTemplate: "<span class='custom-event'>{{dataItem.title}}</span>",
allDayEventTemplate: "<div class='custom-all-day-event'>{{dataItem.title}}</div>",
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: "http://demos.telerik.com/kendo-ui/service/tasks",
dataType: "jsonp"
},
update: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/update",
type: "PUT"
},
create: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/create",
type: "POST"
},
destroy: {
url: "http://demos.telerik.com/kendo-ui/service/tasks/destroy",
type: "DELETE"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "TaskID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
startTimezone: { from: "StartTimezone" },
endTimezone: { from: "EndTimezone" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
ownerId: { from: "OwnerID", defaultValue: 1 },
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
},
filter: {
logic: "or",
filters: [
{ field: "ownerId", operator: "eq", value: 1 },
{ field: "ownerId", operator: "eq", value: 2 }
]
}
},
resources: [
{
field: "ownerId",
title: "Owner",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
]
}
]
};
According to this post at telerik forum you can change the values after initialization modifying HTML to <div kendo-scheduler="sched" k-options="options"></div>
and the accessing sched as a model variable $scope.sched.setOptions(...);
这篇关于动态更新剑道调度选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!