There must be an easier way to set the background color of cells based on a condition.
I have the following code that colors all cells the same color. I will modify it later to constrain it to those cells that I actually need to color.
Before I do, I want make sure I am doing things correctly. My code works, but seems overly complicated. The other issue is that when the color is set I lose the horizontal border. Is there a way to color a cell and keep the 4 borders (i.e. the gridlines)?
Any guidance would be greatly appreciated.
function gridDataBound(e)
{
var grid = this;
var headerCells = grid.element.find("th");
var data = $("#grid").data("kendoGrid").dataSource.data();
var i;
var j;
var dataItem;
rows = e.sender.content.find('tr');
for (i = 0; i < rows.length; i++)
{
dataItem = data[i];
var rowCells = grid.element.find("tr[data-uid=" + dataItem.uid + "] td");
for (j = 0; j < rowCells.length; j++)
{
$(rows[i]).children('td:eq(' + j + ')').css("background-color", "yellow");
}
}