Hi Guys,
I've been going over a lot of posts in regards to conditional formatting of the Grid Control's cells. I've now ended up with the below code. However this does not want to change anything on the intended cell... Everything stays the same.
Based on the code I was expecting the cell in the column "WO Type" to change it's background color if the value of the cell containing ERR_CAUSE had a 403 value in it. What am I missing out on here?
@(Html.Kendo().Grid(Model)
.Name("Shiftreport")
.Events(events => events.Change("Grid_OnRowSelect"))
.Columns(columns =>
{
columns.Bound(o => o.WORK_TYPE_ID).Title("WO Type");
columns.Bound(o => o.TOP_EQUIPMENT_ID).Title("Equipment");
columns.Bound(o => o.ERR_DESCR_LO).Title("Work Order");
columns.Bound(o => o.ERR_CAUSE).Title("Cause");
columns.Bound(o => o.MAX_EQUIP_DOWN_TIME_START).Format("{0:dd/MM HH:mm}").Title("DT Start");
columns.Bound(o => o.MAX_EQUIP_DOWN_TIME_END).Format("{0:dd/MM HH:mm}").Title("DT Stop");
})
.CellAction(cell =>
{
if (cell.Column.Title == "WO Type")
{
if (cell.DataItem.ERR_CAUSE == "403")
{
//Set the background of this cell only
cell.HtmlAttributes["style"] = "background:red;";
}
}
})
.Pageable(pageable => pageable
.PageSizes(true)
)
.Sortable()
.Selectable()
.Navigatable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.ServerOperation(false)
.Model(model => { model.Id(p => p.WO_NO); })
.Sort(sort => sort.Add(o => o.MAX_EQUIP_DOWN_TIME_START).Descending())
))
Thanks in advance!