在将数据绑定到调度程序后,如何从Kendo调度程序检索数据。我有一个javascript函数设置为绑定网格数据后触发。当javascript函数触发时,我需要从网格中获取数据源。
@(Html.Kendo().Scheduler<Optic_Freedom.Areas.Scheduling.Models.CalendarViewModel>()
.Name("scheduler")
.Date(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day))
.StartTime(new DateTime(2013, 6, 13, 07, 00, 00))
.EndTime(new DateTime(2013, 6, 13, 23, 00, 00))
.Editable(false)
.Height(900)
.Events(e=> e.DataBound("someFunction"))
.EventTemplate(
"<div style='font-size:8pt;'>#= kendo.toString(title) # - #= kendo.toString(start, 'HH:mm') # - #= kendo.toString(end, 'HH:mm') # (#= kendo.toString(TotalPersonnel) #)</div>"
)
.Views(views =>
{
views.DayView();
views.MonthView(month => month.Selected(true).DayTemplate("<div id=\"DayClass\" style='float:left'><span class=\"theDate\">#= kendo.toString(date, 'dd')#</span> - (<span id=\"PersonnelDayCount\"/>)</div>"));
views.AgendaView(a =>a.Title("Event List"));
})
.DataSource(d => d
.Model(m => m.Id(f => f.Id))
.Read("GetSchedule", "ScheduleHome")
)
)
- 尝试获取数据的javascript函数
function someFunction(e) {
var model = $("#scheduler").data("kendoScheduler");
-- can't get the model data
}
我需要在someFunction(e)中输入什么来获取数据?
答案 0 :(得分:5)
我假设您正在寻找:
var data = this.dataSource.data();
答案 1 :(得分:1)
我需要 var model = $(“#scheduler”)。data(“kendoScheduler”)。dataSource;
然后从那里我可以循环通过模型 $ .each(model.data(),function(index,item){做某事......});