내 프로젝트에 Knockout-kendo.js binding for Kendo Scheduler을 사용하고 있습니다.kendo 스케줄러 업데이트/재 할당 용 KO 바인딩 처리기 만들기
스케줄러에서 나는 Horizontal Grouping도 사용하고 있습니다. 그래서, 여기에 내가 내 변수 아래와 같이 선언 한 DataSource and well as Resources with group.
을 사용하고 있습니다 :
monitorData = ko.observableArray(),
schedulerData = ko.observableArray(),
내 활성화 방법 : 내 서비스 호출 활성화 방법을 완료하기 전에
activate = function (args) {
getMonitorData();
getschedulerData (08, 09, 2014);
},
반환되고있다. 여기서 Observable 배열이 작동해야합니다. 하지만 실제로 내 스케쥴러에 데이터를 할당하지 않습니다. 비록 관찰 가능한 배열에 데이터가 있습니다.
내 스케줄러 코드 : 내가 하드 코드의 초기화하기 변수에 데이터, 그것의 일을 얻는 것이
<div class="scheduler">
<div id="scheduler" data-bind="kendoScheduler:
{
date: new Date(),
startTime: new Date('2014/6/13 12:15 AM'),
endTime: new Date('2014/6/13 11:54 PM'),
height: containerHeight,
views: [{ type: 'day', selected: true, majorTick: 15 }], //'week', //'month', //'Agenda'
editable: false,
useKOTemplates: true,
eventTemplate: $('#event-template').html(),
allDaySlot: false,
timezone: 'Etc/UTC',
footer: { command: false },
dataSource: schedulerData(),
group: { resources: ['Monitors'] },
resources: [{ field: 'scheduleId', name: 'Monitors', dataSource: monitorData(), title: 'Monitors' }],
dataBound: function() { $('.k-floatwrap ul li.k-nav-current').hide(); }
}">
</div>
</div>
. 따라서 시간 간격도 없으므로 데이터가 스케줄러에 지정됩니다. 아래처럼
는 :
processMonitors = processMonitorMapper(monitors), // Functio without service call - returns hard code data
schedulerData = schedulerDataMapper(rawData), // // Functio without service call - returns hard code data
나는 그것의 초기 데이터의 초기화 이후에 할당 된 경우 검도 스케줄러에 의해 이해되지 않습니다 관찰 배열 데이터를 알게되었습니다. 그래서 나는 시도했다 ko.toJS
. 이것은 나에게도 도움이되지 않습니다.
이러한 종류의 문제를 방지하려면 다음을 수행하십시오. 나는 스케쥴러에 ko.bindhandlers
을 시도했다.
코드 :
ko.bindingHandlers.kendoScheduler = {
init: function (element) {
var sch = $(element).data("kendoScheduler");
console.log("Scheduler Initiated");
},
update: function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
//var scheduler = $(element).data("kendoScheduler");
//if (scheduler != null) {
//if (value.dataSource != null && value.dataSource.length > 0 && value.resources[0] != null && value.resources[0].dataSource.length > 0) {
// $(element).kendoScheduler({ dataSource: value.dataSource, resources: value.resources });
//}
var dataSource = new kendo.data.SchedulerDataSource({
data: value
});
$(element).data("kendoScheduler").setDataSource(dataSource)
//}
console.log("Scheduler Updated");
}
};
그러나 문제는 작동하지 않습니다 위의 코드이다. 위의 문제를 해결할 수 있도록 도와주십시오.
추가 정보 : 또한 데이터 소스 & 스케줄러 자원을 변경해야합니다. 매일 매일 현명합니다. 날짜는 검도 달력을 통해 선택됩니다. 나는 매일 서비스 선택을 현명해야한다. 새로운 데이터 소스를 Kendo Scheduler.
에 할당해야합니다.
kendo 스케줄러 데이터 소스 & 리소스를 어떻게 동적으로 할당합니까? 만약 내가 observable 배열에 할당하지 않으면 작동하지 않는/내가 위에서 말한 것처럼 할당되지.
kendoScheduler Update/Init에 ko.bindingHandlers를 쓰려면 어떻게해야합니까?