Skip to main content

template

Optional. A function which returns a template with content for a cell

Usage

template?: (cellValue, row: IRow, column: ICol) => string;

Parameters

The template function takes 3 parameters:

  • cellValue - (required) the value of a cell
  • row - (required) an object with all cells in a row
  • column - (required) an object with the configuration of a column (see the columns config)

Example

const grid = new dhx.Grid("grid_container", {
columns: [
{
id: "netChange", header: [{ text: "Net Change" }],
htmlEnable: true,
template: (cellValue, row, column) => {
return "<input type=\"checkbox\" " + (cellValue /> 300000 ? "checked": "") + ">";
}
},
// more columns configuration objects
],
// more options
});

Related article: Adding template to cells

Related sample: Grid. Cell templates