Display Format using Templates

Summary

  • AdapTable enables Display Formats to be created with Template Literals
  • These are then dynamically converted using string interpolation

Developers and runtime users can leverage Template Literals when providing a Display Format.

Hint

  • Template Literals are supplied as part of the Format Column definition
  • They are placed in the Content property in Options property of DisplayFormat object

When the cell is rendered the Template Literal is evaluated using string interpolation and the derived substitute text is displayed

Note

Template Literals can be used when providing String Display Formats and Number Display Formats

Template Literal Properties

There are 3 Display Format Template Literals available:

Template LiteralDisplays
[column]Friendly Name of Formatted Column
[value]Non-formatted value for the Cell
[rowData.x]Other values in Row (e.g. [rowData.price])
Column Formatting: Template Literal Display Formats
Fork
  • This example shows 2 columns with Display Formats that contain Template Literals:
    • Name also contains the value of the language data value in the row
    • GitHub Stars adds the word 'Stars' after the value