Gray out a row in kendo grid based on column value

前端 未结 2 465
后悔当初
后悔当初 2021-01-27 23:19

I have a Kendo Grid whose values get populated based on a post call. I need to gray out an entire row if one of the column has a value \"REGISTERED\".

Is there a way we

2条回答
  •  有刺的猬
    2021-01-27 23:51

    Look this example, I'm checking every row to see if it matches a condition, then colouring it. You just need to add this event in the DataBound event of the grid like this

    .DataBound("onRowBound")
    

    Then, check the condition

    static onRowBound(e) {
       var grid = $("#Funciones").data("kendoGrid");
        grid.tbody.find('>tr').each(
            function () {
                var dataItem = grid.dataItem(this);
                if (dataItem.ColumnName == "REGISTERED") {
                    $(this).css('background', 'gray');
                }
            });
    }
    

提交回复
热议问题