JavaScript Data Grid Column headers

Use default column headers (A, B, C), or set them to custom values provided by an array or a function.

Overview

Column headers are gray-colored rows used to label each column or group of columns. By default, these headers are populated with letters in alphabetical order.

To reflect the type or category of data in a particular column, give it a custom name and then display it in a column header. For example, instead of letters as labels such as A, B, C, ... name them ID, Full name, Country, ....

Default headers

Setting the colHeaders option to true enables the default column headers as shown in the example below:

    Header labels as an array

    An array of labels can be used to set the colHeaders as shown in the example below:

      Header labels as a function

      The colHeaders can also be populated using a function as shown in the example below:

        Nested headers

        More complex data structures can be displayed with multiple headers, each representing a different category of data. To learn more about nested headers, see the column groups page.