Cell backgroundcolor depending on cell value


I want to have different cell background colors, depending on what the value of the cell is.
Also, when editing a cell, the color should change (f.e. to “red”).

How can this be done?


Some cell types are already have such ability:
dhtmlx.com/docs/products/dht … combo.html
Please look at the columns “Sales” and “Price”.

If you need some custom stylization you ma create custom ExCell type with all needing attributes.
PLease read the following turial:
docs.dhtmlx.com/doku.php?id=dhtm … l_creation

I cannot find it… When the grid loads it should check the values in the cells and change the backgroundcolor depending on the value…
can you please post an example here?


You may create your own custom ExCell type with any needing options.

Please read the following tutorial to learn more:
docs.dhtmlx.com/doku.php?id=dhtm … le_excells

solved :smiley:

one more question:

I found how to make an Excell:

function eXcell_edC(cell){ if (cell){ this.cell = cell; this.grid = this.cell.parentNode.grid; eXcell_ed.call(this); } this.setValue=function(val){ this.setCValue( if (val=="") this.cell.style.backgroundColor="#b0d6a5"; else if (val=="") this.cell.style.backgroundColor="#b0d6a5"; } this.getValue=function(){ if (this.cell._clearCell) return ""; return this.cell.innerHTML.toString()._dhx_trim(); } } eXcell_edC.prototype = new eXcell;

Is it also possible to add some code in this part, so that the Excells show a combobox when clicked on it?

tx again!

You should redefine setValue() method and add select box as cell content

this.setCValue("any custom html here",val);

Why do you support-people make things ALWAYS so difficult???
Every time I ask a question, the answer is: go to this link, go to that link, add code here, …

Do you people really think I already tried that??? Do you people think I didn’t read the whole documentation??? It’s because I CANNOT FIND the code that I ask a question here…

I gave you my whole excell-code, and just want to add a dhtmlxcombo to it…

Can someone of the support-team PLEASE give me the code how to do this? I can post a 1000 times the wrong codes, and you can give me 1001 times the link but I do not find it!!

So please, edit my code so it uses dhtmlxcombo…

Creating custom eXcell type for you is out of support.

It’s not the support team’s job to write your code for you. The tutorial that was linked should be enough to get you where you need to go. Not to mention the original point of this topic seems to have been answered…

And being a jerk isn’t going to get you farther with anyone.