0

I have a KendoUI Grid that is working just fine but I cannot add background color to rows.

I found some code that is supposed to iterate over the rows, but when I run it it simply goes in an infinite loop.

There are many posts about this topic but most of them are far more complex than I would like.

Any help would be greatly appreciated.

$(document).ready(function() {

    $("#grid").kendoGrid({
        dataSource: {
        type: "jsonp",
        transport: {
        read: "XXXX.xpRest.xsp/xpRest1"},
        pageSize: 20},
        batch: true,
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
                  },
        pageSize: 15,
        height: 543,
        selectable : true,
        columns : [{
            field : "name",
            title : "Name"
        },{
            field : "strDate",
            title : "Start Date",
            width : 150
        },{
            field : "$10",
            title : "End Date Date",
            width : 150
        }],     
        dataBound: function () {
                dataView = this.dataSource.view();
//<!--                for (var i = 0; i < dataView.length; i++) {-->
//<!--                    if (i = 0) {-->
//<!--                        var uid = dataView[i].uid;-->
//<!--                        $("#grid tbody").find("tr[data-uid=" + uid + "]").addClass("onCall");  //alarm's in my style and we call uid for each row-->
//<!--                    }-->
//<!--                }-->
            }
        });
});
Bryan Schmiedeler
  • 2,977
  • 6
  • 35
  • 74

1 Answers1

1
     dataBound: function (e) {
                        // Color rows
                        var rows = e.sender.tbody.children();
                        for (var j = 0; j < rows.length; j++) {
                            var row = $(rows[j]);                           
                            row.css('background-color', '#FFFFE0');
                        } 
      }
calinaadi
  • 1,466
  • 1
  • 13
  • 22