public interface CellFormatter
ListGridField
or entire
ListGrid
.Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(java.lang.Object value,
ListGridRecord record,
int rowNum,
int colNum)
Returns the HTML to display in the cells of the field (or entire grid if so applied).
|
java.lang.String format(java.lang.Object value, ListGridRecord record, int rowNum, int colNum)
format()
returns
a display value as HTML. The value passed to this method is the raw value for the cell.
A CellFormatter
defined at the field level takes
precedence over one defined at the grid level for the cells of that field.Example usage: formatting a currency value stored in cents (so "100" to "$1.00")
Note: this formatter will not be applied to the values displayed in cells being
edited. Define a CellEditValueFormatter
and
apply it to the field.
value
- raw value for the cell, from the record for the rowrecord
- Record object for the cell. Note: If this is a new row that has not been
saved, in an editable grid, it has no associated record object. In this case the edit
values will be passed in as this parameter (see ListGrid.getEditValues()
)rowNum
- row number for the cellcolNum
- column number for the cell.ListGridField.setEditValueFormatter(com.smartgwt.client.widgets.grid.CellEditValueFormatter)
,
Format values Example