I have a TreeGrid I am populating with values which contain leading and trailing spaces (" Group A "). It seems that the grid component is automatically trimming the empty spaces before the value is rendered. Is there a way to disable this feature or a known workaround?
Announcement
Collapse
No announcement yet.
X
-
The GWT code is rendered in the HTML form which ignores the white space. So format the listgrid cell value to replace the white spaces with " ". This will render the grid with the leading and trailing spaces visible.
listGridField.setCellFormatter(new CellFormatter() {
@Override
public String format(Object value, ListGridRecord record,
int rowNum, int colNum) {
if (value != null) {
return String.valueOf(value).replaceAll(" ", " ");
}
return null;
}
});
Comment