table questions

Hi:

I have two questions regarding tables. Please excuse me if the answer is too obvious…

1.- Can a column and its header have different aligments?..if I use
table.setColumnAlignment(propertyId,Table.ALIGN_RIGHT);
the header also moves right, and I want it to stay in the center…

2.- The container data source of the table (mysql) is formated as
Double
, with a lot of decimals, and I want to show the data as
Integer
, with thousand separators…how can I do this?

regards, and thank you very much, as always…

Bonjour,

1.- the setColumnHeaders method of Table accepts only an array of Strings. So, except providing an extra style for each column header, I have no other idea.

2.- the class com.vaadin.data.util.PropertyFormatter enables to provide your own format for the TextField values. The example provided in the API page is a bit too simple compared to what you are planning, but this is a beginning. In fact, I have another issue with formatting. I want to have an automatic formatting of TextFields according to the type of data (Integer, Double, String) in the FormFactory or TableFactory. fOr the moment, I am only able to customize the Field according to the type of Field (TextField, DateField).

Good week-end,

Gilles Carpentier

Gilles, thank you very much for your answer…

I tryed what appears in the book, on chapter
5.14.6 Formatting Table Columns
and works fine for formatting the column numbers.

In the image appearing in that chapter, a right aligned columns has its header left aligned…Does anyone know how to do that without using CSS?..

regards,

Hugo