Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Angus Lyon on Sep 10, 2007 20:38
open dhtmlx forum
dhtmlgrid: colour picker cell type + text data

Hi,

I have an application that would benefit from having a column in the grid which has the cell in each row of the column a different colour depending on the value from a field in the attached database.

I can use the colourpicker column type to display the colour but what I want to do is add the value upon which the colour was selected in the same cell as well as the background colour.

Can I do this?

Angus
Answer posted by Stanislav on Sep 11, 2007 10:48
a) in case of loading from css you can use style attribute of row

<row id='1' style='background-color:red;' >
    ....

b) In case of after-edit functionality you can use code similar to next

grid.attachEvent("onCellChanged",function(rid,cind,val){
    if (cind==INDEX)
       grid.setRowTextStyle(rid,"background-color:"+value);
});

where INDEX - index of column with colorpicker