I need a way to run javascript code after a sort or a filter has been done. Unusually, the datasource is in the view model - not an ajax call to the server.
Here is my grid:
@(Html.Kendo().Grid(Model.TrunkGridData)
.Name("TrunkSummaryGrid")
.Columns(columns =>
{
columns.Bound(c => c.DepotNumber).Title("Depot").Sortable(true);
columns.Bound(c => c.TrunkName).Title("Trunk").Sortable(true);
columns.Bound(c => c.TipType).Title("Tip / Load").Sortable(true);
columns.Bound(c => c.ArrivalTimeExpected).Title("Booked Arrival").Sortable(true);
columns.Bound(c => c.ArrivalTimeActual).Title("Actual Arrival").Sortable(true);
columns.Bound(c => c.DepartureTimeExpected).Title("Booked Departure").Sortable(true);
columns.Bound(c => c.DepartureTimeActual).Title("Actual Departure").Sortable(true);
})
.Filterable()
.Sortable()
.Scrollable()
.Selectable()
.HtmlAttributes(new { style = "height:700px;" })
.ToolBar(tools => tools.Excel())
.Excel(excel => excel
.FileName("TrunkSummary.xlsx")
.Filterable(true)
.ProxyURL(Url.Action("Excel_Export_Save", "Grid"))
)
.DataSource(dataSource => dataSource
.Custom()
.ServerFiltering(false)
.ServerSorting(false)
.Schema(schema => schema
.Model(model =>
{
model.Id("TrunkRouteID");
model.Field("DepotNumber", typeof(string));
model.Field("TrunkName", typeof(string));
model.Field("TipType", typeof(string));
model.Field("ArrivalTimeExpected", typeof(string));
model.Field("ArrivalTimeActual", typeof(string));
model.Field("DepartureTimeExpected", typeof(string));
model.Field("DepartureTimeActual", typeof(string));
model.Field("IsLate", typeof(bool));
model.Field("IsThirtyMinutesLate", typeof(bool));
model.Field("ArrivalMinsLate", typeof(double));
model.Field("DepartureMinsLate", typeof(double));
model.Field("TrunkRouteID", typeof(int));
})
)
)
)