customizeCell

customizeCell(customizationCellFunction: Function)

A hook that is triggered for each cell to customize its content and style. Supports adding links, custom styles, and formatting. Available both as an initialization parameter and an API call.

Parameters

customizationCellFunction — a function that defines which cells will be customized and how. Receives the following parameters:

ParameterTypeDescription
cellStyleCell Style ObjectContains information about the cell representation. Use this object to customize cell appearance.
cellDataCell Data ObjectContains information about the cell and its data.

Cell Style Object:

ParameterTypeDescription
attrObjectSpecifies the cell’s attributes and their values. It allows adding custom attributes, which later can be used in CSS selectors. Additional info about CSS attribute selectors.
classesArray of StringsContains all cell’s classes. A new class can be added via the addClass() method (see below).
styleObjectContains a CSS style for the cell.
tagStringContains a tag element of the cell.
textStringContains a text of the cell (may contain HTML elements, e.g., images).
addClass(value: String)MethodAdds a new class to the cell.
toHtml()MethodReturns the cell as an HTML string.

Example

Add colors to alternate rows: