Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align text of selected CellTable columns in GWT?

Tags:

css

gwt

gwt2

I want to right-align numeric values in a CellTable. I already tried looking for ways to assign a style name for selected columns so I could align it with CSS but still couldn't figure out.

enter image description here

I also tried this but didn't work,

itemPriceColumn.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);

According to the GWT documentation, the new horizontal alignment will apply the next time the table is rendered... and I don't know yet what parameters I have to pass since it is required by render() method.

So I'm hoping for answers that would involve CSS.

like image 336
Mr. Xymon Avatar asked Nov 18 '25 06:11

Mr. Xymon


2 Answers

Well, what you had is almost right. This works for me, without css: myColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

like image 60
eon Avatar answered Nov 21 '25 10:11

eon


unitPriceColumn.setCellStyleNames("alignRight");

totalAmountColumn.setCellStyleNames("alignRight");

Where alignRight is the name of your CSS.

.alignRight {text-align:right}
like image 22
Rajaa Avatar answered Nov 21 '25 10:11

Rajaa