I am getting an error when i try to refresh the data source of my grid.
Here is the code...
$(function () {
setInterval(function () {
$('#eventLog').data('kendoGrid').dataSource.page(1);
$('#eventLog').data('kendoGrid').dataSource.read();
},
60000);
});
0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'dataSource': object is null or undefined
The grid code is this...
@(Html.Kendo().Grid(Model.DailyLogEventList)
.Name("dailyLogGrid")
.HtmlAttributes(new { style = "height: 250px" })
.Events(events => events.DataBound("dataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(8)
.Read(read => read.Action("DailyLogList_Read", "DailyLog")))
.Columns(columns =>
{
columns.Bound(x => x.IncidentAttached)
.ClientTemplate("<a href='" + Url.Action("index", "IncidentReport", new { area = "DailyLog", logId = "#=LogId#'>" }) + "#= IncidentAttached ? '<img src=\"/Images/icon_edit.gif\" />' : '' #" + "</a>")
.Width(10)
.Title("")
.Filterable(false);
columns.Bound(p => p.Status).ClientTemplate("# if(Status === 'OPEN') { #" +
"<img src='/images/open.png' />" +
"# } else if(Status === 'CLOSED'){ #" +
"<img src='/images/closed.png' />" +
"# } else { #" +
"<img src='/images/10days.png' />" +
"# } #")
.Width(10)
.Title("")
.Filterable(false);
columns.Bound(x => x.LogId).Width(25).Title("Id");
columns.Bound(x => x.StartDate).Title("Started").Format("{0:MM/dd/yyyy HH:mm}").Width(40).Sortable(true);
columns.Bound(x => x.EventDescription).Title("Event").Width(60).Filterable(filterable => filterable.UI("eventDescFilter"));
columns.Bound(x => x.Comments).Title("Comments").Width(63);
columns.Bound(x => x.RespondingOfficers).Title("Officer(s)").Width(70);
columns.Command(command => command.Custom("Edit").Click("loadDataForEdit")).Width(20);
})
.Pageable()
.Selectable(s => s.Mode(GridSelectionMode.Single))
.Filterable()
.Scrollable()
)
Here is the code...
$(function () {
setInterval(function () {
$('#eventLog').data('kendoGrid').dataSource.page(1);
$('#eventLog').data('kendoGrid').dataSource.read();
},
60000);
});
0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'dataSource': object is null or undefined
The grid code is this...
@(Html.Kendo().Grid(Model.DailyLogEventList)
.Name("dailyLogGrid")
.HtmlAttributes(new { style = "height: 250px" })
.Events(events => events.DataBound("dataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(8)
.Read(read => read.Action("DailyLogList_Read", "DailyLog")))
.Columns(columns =>
{
columns.Bound(x => x.IncidentAttached)
.ClientTemplate("<a href='" + Url.Action("index", "IncidentReport", new { area = "DailyLog", logId = "#=LogId#'>" }) + "#= IncidentAttached ? '<img src=\"/Images/icon_edit.gif\" />' : '' #" + "</a>")
.Width(10)
.Title("")
.Filterable(false);
columns.Bound(p => p.Status).ClientTemplate("# if(Status === 'OPEN') { #" +
"<img src='/images/open.png' />" +
"# } else if(Status === 'CLOSED'){ #" +
"<img src='/images/closed.png' />" +
"# } else { #" +
"<img src='/images/10days.png' />" +
"# } #")
.Width(10)
.Title("")
.Filterable(false);
columns.Bound(x => x.LogId).Width(25).Title("Id");
columns.Bound(x => x.StartDate).Title("Started").Format("{0:MM/dd/yyyy HH:mm}").Width(40).Sortable(true);
columns.Bound(x => x.EventDescription).Title("Event").Width(60).Filterable(filterable => filterable.UI("eventDescFilter"));
columns.Bound(x => x.Comments).Title("Comments").Width(63);
columns.Bound(x => x.RespondingOfficers).Title("Officer(s)").Width(70);
columns.Command(command => command.Custom("Edit").Click("loadDataForEdit")).Width(20);
})
.Pageable()
.Selectable(s => s.Mode(GridSelectionMode.Single))
.Filterable()
.Scrollable()
)