I'm hoping to use RowAction with a lambda to set the background color of a few rows of data in a Grid.
<%: Html.Kendo().Grid<HomeController.SuccessfulBuildsByDevice>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.A);
columns.Bound(p => p.B);
})
.Scrollable()
.Sortable()
.Filterable()
.RowAction(row =>
{
if(row.DataItem.A > row.DataItem.B)
row.HtmlAttributes["style"] = "background:red";
})
.HtmlAttributes(new { style = "height:500" })
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("_GetData", "Home"))
.ServerOperation(false)
)
%>
However, when I use the above the RowAction() doesnt seem to be called. I tried setting a breakpoint, etc. Am I missing something in the intended use of RowAction(), does anyone see an obvious problem?
For styling individual cells of grid with a template: In order to format Kendo Grid Column value with conditionally chosen action you can use the example below. For more information: How Do I Have Conditional Logic in a Column Client Template? Show activity on this post.
the problem is .Ajax() and .RowAction() are mutually exclusive
http://www.kendoui.com/forums/kendo-ui-web/grid/ajax-binding-and-rowaction-conflict-.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With