I am trying to change the background color of a table’s cell based on the value. I am able to do this easily with a custom field renderer and a snippet using the following code. However, this changes the div inside the cell and I’d like to change the whole cell color.
var field = argumentse0],
value = argumentse1],
$ = skuid.$;
console.log(field.element.parent());
console.log(value);
if (value >= 500) {
field.element.css(‘background-color’, ‘red’);
field.element.css(‘color’, ‘white’);
field.element.text(value);
}
else if (value < 500) {
field.element.css(‘background-color’, ‘green’);
field.element.css(‘color’,‘white’);
field.element.text(value);
}
This works OK, but I’d like to change the whole cell’s background color and not just the text div. However, when I try “field.element.parent()” or “$(field.element.parent()” or “field.element0].parentElement”, etc… I can’t select the parent element.
How can I select the parent of the parent element that the field renderer snippet sends as the argumentns0]?