HasHorizontalAlignment.ALIGN_RIGHT has strange result in datagrid column

47 views
Skip to first unread message

tong123123

unread,
Nov 20, 2012, 12:11:56 AM11/20/12
to google-we...@googlegroups.com
My DataGrid has 6 columns and I want the last column to align right, I write

NumberCell numberCell = new NumberCell();
Column<ServiceLogLevel, Number> debugLogLevelCol = new Column<ServiceLogLevel, Number>(numberCell){           
    @Override
    public Integer getValue(ServiceLogLevel serviceLogLevel) {
        // TODO Auto-generated method stub
        return serviceLogLevel.getDebugLogLevel();
    }               
};
debugLogLevelCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
resultGrid.addColumn(debugLogLevelCol, "debug log level");

but I found the data cannot be shown (columnAlignRight.jpg), but if change to use Align_center or align_left, the data can be shown correctly (as shown in columnAlignCenter.jpg).
Using IE8 debug mode, I see that the
<div> is wider than the <td>,
and I think if using align right, the data is shown outside the <td> and so cannot be seen.
why will this happen?

Also, I am using gwt 2.4, I check the api and datagrid has no method
setWidth(java.lang.String width, boolean isFixedLayout)
as in CellTable?

 



columnAlignCenter.jpg
columnAlignRight.jpg
setWidth.jpg

tong123123

unread,
Nov 20, 2012, 1:20:39 AM11/20/12
to google-we...@googlegroups.com
I just found that in Firefox 13.0.1, HasHorizontalAlignment.align_right works prefectly correct in datagrid column!!
But it has problem in IE8.
columnAlignRightFF.jpg

tong123123

unread,
Nov 20, 2012, 10:21:21 PM11/20/12
to google-we...@googlegroups.com
any one how to solve?
I try to use css
.class1{
text-align:right;
}

and then in code, write
resultGrid.getColumn(5).setCellStyleNames("class1");

but the result is the same, the data can show in FF but not in IE8!!

Thomas Broyer

unread,
Nov 21, 2012, 6:13:43 AM11/21/12
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages