I have some trouble with kendo ui scheduler component.
I'm getting my scheduler events from ms exchange via php exchange web services. Because of performance I don't want to load thousands of elements on calendar init.
Therefore I'm loading currents' week items only by default. On navigate event I want to update schedulers datasource.
My code is:
$("#scheduler").kendoScheduler({
date: new Date(y+"/"+m+"/"+d),
dateHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'ddd, dd.MM.')#</strong>"),
startTime: new Date(y+"/"+m+"/"+d+" 00:00 AM"),
workDayStart: new Date(y+"/"+m+"/"+d+" 07:00 AM"),
workDayEnd: new Date(y+"/"+m+"/"+d+" 8:00 PM"),
height: 600,
navigate: schedulerNavigate,
views: [
"day",
"week",
{ type: "workWeek", selected: true },
"month",
"agenda"
],
dataSource: {
batch: true,
transport: {
read: {
url: myDataUrl,
dataType: "json"
}
}
}
...and some more options here...
});
"Naviagte" event calls schedulerNavigate() function:
function schedulerNavigate(e) {
var
scheduler = $("#scheduler").data("kendoScheduler"),
dataSourceUrl = myDataUrl+kendo.format("?view={1}&date={2:d}", e.action, e.view, e.date),
dataSource = new kendo.data.SchedulerDataSource({
transport: {
read: {
url: dataSourceUrl,
dataType: "json"
}
}
});
// set datasource
scheduler.setDataSource(dataSource);
}
When schedulerNavigate function is entered, the dataSource url is called, json will be returned. Everythings good so far... BUT: Url will be called twice! Schedulers' data will be cleared but new data won't be set.
Any idea?
Thanks a lot!
Philip
navigateevent triggers a read of the widget's datasource automatically. Have you triede.preventDefault(), set the new dataSource, and then triggered adataSource.read()manually in yourschedulerNavigatefunction? - Brette.preventDefault();to the first line of schedulerNavigate function. Also I addedscheduler.dataSource.read();behind the setDataSource command. Unfortunately that didn't help. - Philip