dhtmlx touch grid coloring

Hi,
I try to color complete grid cells (background-color) depending on values provided as Json data.
Currently I am using the template:function functionality of a column, generating a span:

template:function(obj) {
return obj.field_1==‘X’?"":"";

Unfortunately this only changes the background color of the span (which is 0), but not of the whole cell.

Any ideas how I could color the whole td/div of the cell?

Thanks in advance

PS: I am quite new to HTML and CSS, so it could be stupid question.

Hi,

you may define “css” property for the field. But it is the same for all rows of a certain column. To change it depending on some row property you may use the following approach:

view:"grid", type:{ templateCss:function(obj,type){ type.fields["field_1"].css = obj.field_1=='X'?"red":"green" return ""; } }, ...

Here “field_1” is the id o the field that will get “red” or “green” className for its cells