Search code examples
javagwtcelltable

GWT CellTable wordwrap


I want to set fixed column width, but when content (String) is longer than width of column, then width of column stretch to width of string. enter image description here

But I need to have static width of column, not modifiable, and when content is longer, then transfer content to the next line. Thanks


Solution

  • Assuming you have code

    cellTable.addColumn(column1);
    cellTable.addColumn(column2);
    cellTable.setColumnWidth(column1, 120.0, Unit.PX);
    cellTable.setColumnWidth(column2, 350.0, Unit.PX);
    

    in you style.css

    .wordWrap{
     width:100%;
     word-wrap: break-word;
    }
    

    Then Set CSS

    cellTable.setStyleName("wordWrap");