About


 



 

About Grid :How to change font family and font size of a whole column

I am using dhtmlGrid,now I have a question about font family of column:
I want to set a column's font,the cells belongs to this column have the same font family, and it is different from other columns .but now I could not find how to do that.all cases is below :
1),the grid is loaded from a xml named A.xml .at this case ,how should I do?
2).the grid is iterated in the jsp file,how should I do ?
you answers is
a) define cpecific style in XML 
in HTML

     .my_column{ .. }

in XML

  ...
  ...
  ...
  ...



b) do the same but in js code

grid.attachEvent("onRowCreated",function(id){
    grid.cells(id,1).cell.className="my_column";
    return true;
});

////////////////////////////////////////////////


thanks for your email;


if I do just as you say in mail ,that may change other style of that column,I want to just add a external style to that column dynamic,not to replace the style


arignal,if the grid's column has method like "setFont",just like cell has the method setFont,


Thank you very much

Column has not default css class assigned, so both solution will not make any harm.
>>not to replace the style
by adding your custom css class to the cell you will not change anything ( technically, you may need to add !important flag to rules in your custom class to override default values )

>>arignal,if the grid’s column has method like “setFont”,just like cell has the method setFont,
There are such methods for separate cells, but there is no such method to apply font to the whole column.