Hello, I'm trying to set specific background color to cells based on their content and ran into a few problems with that.
First of all I've tried using the formatter option like this:
function formatter(row, cell, value, columnDef, dataContext) {
if (columnDef.field == "RGB") {
return "<span class='colorCell' style='background-color:#" + value + "; color:" + getCorrectedTextColor(value) + "'>" + value + "</span>";
} else {
return value;
}
}
The problem with that is that it doesn't fill the entire cell, and has a few pixels space on each cell.
If I manually set the background color on the css class slick-cell, then it does fill the cell completely with no spaces, but I couldn't find any way to affect that without a css class.
I've seen the setCssCellStyles function and getItemMetadata function, but since they each work with only css classes, I can't apply it to this case.
I've tried setting the position and display attributes on the span in an attempt to make it fill the cell, but I couldn't quite get it right.
My questions:
1. Is there a way to make the span fill the entire cell ? That would have solved everything for me.
2. Is there a way to affect the background color of the cell itself without a css class ?
3. Is there some builtin way that I've missed to do what I want ?