Header Renderers

Configure text, sortable, filterable, and custom headers.

Headers are configured through ColumnDef.header. A header can be a string or a HeaderConfig object.

String Headers

string-headers.ts
const columns: ColumnDef[] = [
{ field: 'name', header: 'Name', width: 220 },
{ field: 'email', header: 'Email', width: 260 },
];

Rich Headers

rich-headers.ts
const columns: ColumnDef[] = [
{
field: 'email',
header: {
text: 'Email',
type: 'text',
tooltip: { content: 'Primary contact email' },
trailingIcon: { content: '@', position: 'trailing' },
},
width: 260,
},
{
field: 'status',
header: {
text: 'Status',
type: 'filterable',
filterIndicator: { show: true, dropdownType: 'select' },
},
filterable: true,
width: 140,
},
];

Sortable Headers

sortable-header.ts
const columns: ColumnDef[] = [
{
field: 'price',
header: {
text: 'Price',
type: 'sortable',
sortIndicator: { show: true, ascIcon: '↑', descIcon: '↓' },
},
sortable: true,
width: 120,
},
];

Header Events

header-events.ts
grid.on('header:click', ({ columnIndex, column }) => {
console.log(columnIndex, column.field);
});
grid.on('header:sort:click', ({ columnIndex, nextDirection }) => {
console.log(columnIndex, nextDirection);
});
grid.on('header:filter:click', ({ columnIndex, hasActiveFilter }) => {
console.log(columnIndex, hasActiveFilter);
});
Info

Current public event names use colon-separated names such as header:click, header:sort:click, and header:filter:click.