i have fields in ListGrid that contain long Texts set outside the listGrid via a richTextItem.
Is it possible to only show first 24 characters from the text in the field ?
Thanks!
The problem is that the listGrid then expand every row height to contain every line from the text (while maintaining small width) - e.g. if i have 3 new lines in the text, it will display 3 rows within the cell. All i want to do is to keep the record heights fixed @ whatever height but nothing seems to work. Its ok for me just to display the first 24 characters.
to let the cell value span vertically leaving the row height fixed.
You could also use
listgrid.setFixedRecordHeights (true)
or use a cell formatter to truncate the string using StringUtil.abbreviate()
i.e.
import com.smartgwt.client.util.StringUtil;
...
listGridField.setCellFormatter (new CellFormatter () {
@Override
public String format (final Object value, final ListGridRecord record, final int rowNum, final int colNum) {
return StringUtil.abbreviate ((String)value, 24)
}
});
Indeed, I think it would be very interesting to have a way to dynamically show the ellipsis (the “…”) at the end of the visible cell value when it doesn’t fit the cell room (hence being clipped). Till now I’ve not found a way to get it.