Summary

  • Custom Display Formats can be provided when those provided by AdapTable are insufficient

The Display Format options provided by AdapTable fit the vast majority of real-life use cases.

However, if required, Developers can supply bespoke Custom Display Formatters at design time.

This is done via a 2-stage process:

  1. Defining the Custom Formatter in customDisplayFormatters property in Format Column Options
  2. Referencing the Custom Formatter in Format Column Initial State

customDisplayFormatters

Custom Formatters used in Format Column Module

Hint

  • Only use these when AdapTable's System Display Formats are insufficient for your use case
  • You might also find that a Template Display Format provides what you require with less complexity

Each definition includes a handler function which AdapTable invokes when the cell is rendered and which should return the custom display format.

Caution

  • The scope property in the Custom Formatter tells AdapTable which columns in the UI Wizard should offer the option
  • The actual wiring up is done using the Scope propery in the relevant Format Column Definition
Column Formatting: Custom Formatter
Fork
  • This example provides 4 Custom Display Formats - using the CustomDisplayFormatterContext object for evaluation:
    • for License column where the word 'License' is removed
    • for Created column where we just show the Day of the Week
    • for Issue Change column where we replace 0 values with a '-'
    • for Gitub Stars column where values over one million display M, over one thousand display 'K', or display normally
  • Note: We still also use some of the display formats shipped by AdapTable (i.e. Licence is UPPER CASE and Created is italicised)