Hi there,
Im creating a kendoScheduler that retrieves events for a specific user, see below code (shortened for brevity):
Controller:
@RequestMapping(value=
"/forUserCalendar"
, method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public List<KendoSchedulerEvent> getCalendarEventsForUser(@RequestParam(value=
"userId"
, required =
true
) Long userId) {
System.out.println(
"### forUserCalendar..."
+userId);
//Retrieves events from Database
//Converts Domain Events to KendoSchedulerEvents
return
KendoSchedulerEvent.convertEvents(events);
}
HTML:
var
dataSource_events =
new
kendo.data.SchedulerDataSource({
transport: {
read: {
url:
"/itd-boot-thymeleaf-demo/events/forUserCalendar"
,
dataType:
"json"
,
type:
"GET"
},
parameterMap:
function
(options, operation) {
if
(operation ===
"read"
) {
var
userId = $(
"#select-users"
).getKendoDropDownList().value();
var
result = {
userId: userId,
}
return
result;
}
return
options;
}
}
});
$(
"#scheduler-calendar"
).kendoScheduler({
autoBind:
false
,
dataSource: dataSource_events
});
$(
"#select-users"
).kendoDropDownList({
dataSource: dataSource_users,
dataValueField:
"id"
,
dataTextField:
"fullName"
,
change:
function
() {
if
(
this
.value() !=
""
) {
$(
"#scheduler-calendar"
).getKendoScheduler().dataSource.read();
}
}
});
The Problem:
When my page loads, the read URL is being called from the DS, but there wont be a user selected at this stage as the page just loaded. Is there a way to prevent the DS from being read when its initialized? I thouhg that by including "autoBind" in the Scheduler would help, but its had no effect.
Please advise if you can.
Many Thanks,
Grant