Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pingo on Oct 24, 2008 04:13
open dhtmlx forum
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
<style>
     .my_column{ .. }
</style>
in XML
<row id="some">
  <cell>...</cell>
  <cell class="my_column">...</cell>
  <cell>...</cell>
  <cell>...</cell>
</row>


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

Answer posted by Support on Oct 24, 2008 04:47
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.