I have a grid that I would like to have a column with colors that are different depending on whether or not they contain a phrase which will start with (free or guaranteed or upgrade for example).
I understand that to color a column this code can be changed on the dhtmlxgridcell.js file around line 640:
if (val=="0")
{
this.cell.style.backgroundColor="red";
}
else if (val=="1")
{
this.cell.style.backgroundColor="green";
}
but if i need it to find not an exact match for the word but see if the whole column contains the word what phrasing would I need to use?
Is it also possible to change the font color for the text in the column as well?
So the word “free” would have a cell that would have a red background with yellow text, the word “upgrade” would have a cell that would have a yellow background with red text, etc.?
just a question, can this be used with the free version of DHTMLX or do i need the professional edition?
Thanks, I am still working it out - it gives me a blank white screen now and does not load the data. I am pretty green at this programming so it might take me a while to figure it out
Any chance there is a whole sample file for me to grab the ~ Excell code for setBGColor from as I cannot figure it out for the life of me (and I have been trying but I am unsure what values need to go where and where the code would go exactly)?
We decided to test out the pro version because i think its something we will be using soon anyway!
So I am using “onRowCreated” and its working to color the column, BUT— how do i color the column by searching for a single word that is contained in the field and not the only word in there?
so if i have a row that contains the words: “Free upgrade” I want it colored. Right now its only finding columns that have the word “Free” in it alone? Many thanks
I have attached the code below
grid.attachEvent("onRowCreated", function(Deals){
if (grid.cellById(Deals,0).getValue()="FREE"){
grid.setCellTextStyle(Deals,0,"background-color:red;");
}
});