I have the following grid and it is properly displaying several records added to the list on page load:
@(Html.Kendo().Grid(IndexModel.logHolder.DataList)
.Name("logGrid")
.ToolBar(t => t.Search())
.Columns(columns =>
{
columns.Bound(p => p.CreateDateTime).Title("Date/Time").Format("{0:MM/dd/yyyy hh:mm:ss}").Width(200);
columns.Bound(p => p.ClientId).Title("Client ID").Width(150);
columns.Bound(p => p.ClientName).Title("Client Name").Width(150);
columns.Bound(p => p.Message).Title("Message");
})
.Pageable()
.Sortable()
.Scrollable(scr=>scr.Height(430))
.Search(s => {
s.Field(o => o.CreateDateTime, "eq");
s.Field(o => o.ClientId, "eq");
s.Field(o => o.ClientName, "contains");
s.Field(o => o.Message, "contains");
})
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false)
))I have some signalr code that is running and adding items to the list IndexModel.logHolder.DataList. I can see in my code behind that items are in fact being added to the list.
Immediately after adding an item to the list, I am calling the following javascript to attempt to refresh the data, but it won't refresh:
function refreshData()
{
var grid = $("#logGrid").data("kendoGrid");
grid.dataSource.read();
}What am I missing?
Thanks
