Ok, so I actually managed to figure out a solution to this, using the wrappers after all :) Here's what I did in my cshtml:
@(Html.Kendo().Grid(Model.Alarms)
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(m => m.Id(s => s.AlarmComment))
.Read(read => read.Action("Alarms_Read", "Alarms", new { id = Model.ViewUnitContract.Id }).Type(HttpVerbs.Get))
.AutoSync(true)
)
.Columns(col =>
{
col.Bound(p => p.DateOn).Format("{0:u}").Title("Date");
col.Bound(p => p.Priority).Width(50);
col.Bound(p => p.ExtendedProperty2).Width(100).Title("Action");
col.Bound(p => p.AlarmTag).Title("Name");
col.Bound(p => p.AlarmComment).Title("Comment");
col.Bound(p => p.ExtendedProperty1).Title("AlarmID");
col.Bound(x => x.DateOff).Title("Value");
})
.HtmlAttributes(new {style = "height:430px;"})
)
Here's my controller action:
[HttpGet]
public ActionResult Alarms_Read([DataSourceRequest] DataSourceRequest request, int id, DateTime? startDate, DateTime? endDateFilter)
{
var unit = UnitClient.GetUnit(id);
var fromDate = startDate ?? DateTime.Today.AddDays(-20);
var toDate = endDateFilter ?? DateTime.Now;
Model = new AlarmsViewModel
{
ViewUnitContract = UnitClient.GetUnit(id),
Alarms = AlarmClient.GetAlarmsForUnit(unit.Name, fromDate, toDate)
.Where(x => x.DateOff == null || x.DateAck == null)
.ToArray(),
UnitName = unit.Name,
Unit = new UnitDetailsModel(unit),
FromTime = fromDate,
ToTime = toDate
};
return Json(Model.Alarms.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Hopefully, it'll be of help to someone else :)