Hi,
I need to bind the datasource to ASP.NET MVC Scheduler dynamically. In my scenario, I have 5 dropdownlists. Users will select item from the dropdownlists and then click Search buton and the scheduler will load the result. How can I do that with javascript?
Please see the attached image.
@(Html.Kendo().Scheduler<TaskViewModel>() .Name("schedulerJob") .Date(new DateTime(2015, 8, 31)) .StartTime(new DateTime(2015, 8, 31, 7, 00, 00)) .Height(600) .Views(views => { views.TimelineView(); }) .Timezone("Etc/UTC") .Group(group => group.Resources("Techs").Orientation(SchedulerGroupOrientation.Vertical)) .Resources(resource => { resource.Add(m => m.TechName) .Title("Techs") .Name("Techs") .DataTextField("emm_code") .DataValueField("emm_code") .DataSource(d => d.Read("Techs", "JOBS")); }) .DataSource(d => d .Model(m => { m.Id(r => r.emm_code); }) .Read("JobSchedule_Read", "JOBS") .Create("JobSchedule_Create", "JOBS") .Update("JobSchedule_Update", "JOBS") .Destroy("JobSchedule_Delete", "JOBS") ))
public JsonResult JobSchedule_Read([DataSourceRequest] DataSourceRequest request){ DateTime startDateTime; DateTime endDateTime; List<JscDet> JscDet = (List<JscDet>)Session["JobScheduleDateTime"]; List<TaskViewModel> tasks = new List<TaskViewModel>(); foreach (var item in JscDet) { startDateTime = SchedulerUtility.GetDateTimeFromSeconds(item.jsd_sch_date, item.jsd_sch_start_time); endDateTime = SchedulerUtility.GetDateTimeFromSeconds(item.jsd_sch_date, item.jsd_sch_end_time); tasks.Add(new TaskViewModel() { TaskID = item.jsd_jobno, TechName = item.jsd_sch_assto, emm_code = item.jsd_sch_assto, Title = "Job Title", Start = new DateTime(startDateTime.Year, startDateTime.Month, startDateTime.Day, startDateTime.Hour, startDateTime.Minute, startDateTime.Second), End = new DateTime(endDateTime.Year, endDateTime.Month, endDateTime.Day, endDateTime.Hour, endDateTime.Minute, endDateTime.Second), Description = "Description 101", IsAllDay = false }); } return Json(tasks.ToDataSourceResult(request));}​
Thanks in advance