Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Richard Butler on Jun 12, 2008 12:26
open dhtmlx forum
Cell Style for an entire column


Hi,

I need to set a style of the cells for a specific column. How do I do that? I see how to set style for a row and how to set style for a specific cell, but not how to set it for a column. Is this possible or do I have to loop through each row setting the style on the cell?

Thanks,

Richard Butler

my addr is:

first initial + last name [a t] ajc [d o t] bz
Answer posted by Support on Jun 13, 2008 02:11
There is no way to attach the same style to all the cells in column
If you need to set column color|align it can be done through grid.setColumnColor grid.setColAlign
For any other styles the only possible solution - looping through all rows after data loading.

grid.load(url,function(){
    grid.forEachRow(function(id){
       grid.cells(id,INDEX).cell.style.color="red";
    })
});
Answer posted by Richard Butler on Jun 13, 2008 05:49
Thanks for the reply! Would I also be able to set a className property instead of setting a property on the style object? So:

grid.load(url,function(){
    grid.forEachRow(function(id){
       grid.cells(id,INDEX).cell.className="FancyFrooFrooStyle";
    })
});
Answer posted by Support on Jun 13, 2008 07:20
Yes, it will be correct code as well.
The grid.cells(i,j).cell is HTML element of cell, so any HTML related operation can be executed against it.