Я пытаюсь динамически изменять ресурс dataSource, но изменения, которые я делаю, не применяются к планировщику.Kendo UI Web Scheduler - изменение данных ресурсов динамически динамически
Я создал планировщик следующим образом:
$("#scheduler").kendoScheduler
({
date: new Date(),
startTime: new Date("2013/11/27 07:00 AM"),
endTime: new Date("2013/11/27 06:00 PM"),
height: "600",
selectable: true,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
"agenda"
],
editable: {
template: kendo.template($("#schedulerTemplate").html())
},
dataSource: _dataSourceDetailedAppointmentScheduler,
edit: _api.onEditScheduler,
cancel: _api.onCancelScheduler,
save: _api.onSaveScheduler,
resources: [
{
field: "CommertialRepresentativeId", // The field of the scheduler event which contains the resource identifier
title: "Representante Comercial", // The label displayed in the scheduler edit form for this resource
dataSource: [
{
text: "Representante 1", // Text of the resource instance
value: 1, // Identifier of the resource instance, use that value to assign an event to this instance.
color: "#ff0000" // Used as the background of events assigned to this resource.
},
],
multiple: false // Indicate the this is a multiple instance resource
}
]
});
И после того, как другой контроль модифицируется, я пытаюсь заменить DATASOURCE ресурсы, изменяя цвет событий со значением 1 в поле: " CommertialRepresentativeId "на зеленый.
_dataSourceDetailedAppointmentScheduler.read();
var schedulerControl = $("#scheduler").data("kendoScheduler");
//Construir
var resourceDS = new kendo.data.DataSource(
{
data: [
{ text: "rep 1",
value: 1,
color: "#00ff00"
}
]
}
);
resourceDS.read();
schedulerControl.resources[0].dataSource = resourceDS;
schedulerControl.view(schedulerControl.view().name);
Не может показаться, что планировщик будет продолжать отображать события в исходном цвете.
Буду признателен за помощь!
я в конечном итоге делает это после удаления первоначально включены element: 'schedulerControl.resources [0] .dataSource.add ({text:" Rep 1 ", value: 1, color:" # 00ff00 "});' Это эквивалентно? –
@gaguevaras, если вы хотите изменить только один элемент, который будет работать; Я также отредактировал свой ответ для другой идеи, если вы хотите сделать небольшое изменение в элементе –