Package com.smartgwt.client.widgets.grid

# Interface CellFormatter

public interface CellFormatter
Defines the HTML that's displayed in the cells of a `ListGridField` or entire `ListGrid`.

See Also:
  - `ListGrid.setCellFormatter(com.smartgwt.client.widgets.grid.CellFormatter)`
  - `ListGridField.setCellFormatter(com.smartgwt.client.widgets.grid.CellFormatter)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `format(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).

- ## Method Details

  - ### format

    String format(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). Given the raw value for a field as taken from the record, `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.

    Parameters:
      `value` - raw value for the cell, from the record for the row
      `record` - 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 cell
      `colNum` - column number for the cell.
    Returns:
      HTML to display in the cell
    See Also:
      - `ListGridField.setEditValueFormatter(com.smartgwt.client.widgets.grid.CellEditValueFormatter)`
      - Format values Example