View Full Version : How to make heading text in the center of header

20 May 2009, 5:19 PM
Hello everybody,
I have a question about how to make heading text in the center of header. Is there any appropriate method to resolve the question?


20 May 2009, 6:41 PM
Hi there,

There are a couple ways to do it:

When you build your Grid, in your ColumnConfig for the relevant column:

ColumnConfig myColumn = new ColumnConfig("my", "My", 35);

If it's a Table, same deal on the TableColumn object.

Note that this will align the entire column center, not just the header.

To modify just the Header one possibility might be to get the GridView (<grid>.getView()) and get the header Element using getHeaderCell(int colIndex), and set the style attributes directly.

I am not sure that's the right approach, but it's worth checking out.


20 May 2009, 7:31 PM
first, thanks for you answer.
But if it is in the ContentPanel's heaer, what can I do?

21 May 2009, 5:56 AM
Have you tried using CSS (panel.getHeader().setId(cssId)) and setting text-align: center ?