Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Richard White on Feb 10, 2008 14:38
open dhtmlx forum
get row color

Hi,

just wondering if you have any way of getting a row color.

its easy to set the color as setRowColor(rowid, color), and i have tried getRowColor(rowid)

just wondering if you can help me with this

thanks
Answer posted by Support on Feb 11, 2008 01:45
There is no common solution, how to get color of row, because it can be set in many different ways ( by using style|class of row|cell tag  )
In case of setRowColor you can try to access DOM property directly
    var color=grid.rowsAr[id].bgColor;

where id - ID of row in question
Answer posted by Richard White on Feb 11, 2008 07:51
Hi

thanks for the reply, i have tried doing what you suggested and it outputs an empty string. this is the code i tried

grid.setRowColor(rowid,"#FFDDDE");
alert(grid.rowsAr[rowid].bgColor)

it changes the color of the row fine but then the alert box shows but doesnt display anything, do you have any idea why this is happening and what i can do to get it working please

thanks
Answer posted by Support on Feb 12, 2008 02:22
Sorry for misleading recommendation, the correct code would be

    mygrid.setRowColor(1,"#FFDDDE");
    alert(mygrid.rowsAr[1].firstChild.bgColor)
Answer posted by richard white on Feb 12, 2008 03:52
thanks very much that works fine now

richard