How to have one line per row in a cellTable?
I am using a CellTable on a ScrollPanel in GWT. My table has two columns and I want to give 10% and 90% of the width each. This is fine.
The problem is that I want to have one line of text per row in the table. That is if the content of one cell is too large to be showed in one line, I want to have either a horizontal scrolling bar or just truncate the text to fit it in one line.
Here is an extract of my 开发者_如何学运维code:
cellTable.addColumn(column1);
cellTable.addColumn(column2);
cellTable.setWidth("100%", true);
cellTable.setColumnWidth(column1, 10.0, Unit.PCT);
cellTable.setColumnWidth(column2, 90.0, Unit.PCT);
I also tried to use:
cellTable.setTableLayoutFixed(true);
but it doesn't change the layout.
Thanks a lot for your comments!
Use the CSS property "white-space: nowrap"
More info
You'll have to play with the word-wrap
, overflow
and possibly text-overflow
CSS properties.
精彩评论