Search code examples
cssgwtgwt2

How to align text of selected CellTable columns in GWT?


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.


Solution

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