Columns & visibility
Configure columns (titles, ordering, searchable flags) and toggle visibility at runtime through the DataTables Api exposed by the directive.
| ID | Name | Position | Office |
|---|
columns: ConfigColumns[] = [
{ title: 'ID', data: 'id', searchable: false },
{ title: 'Name', data: 'name' },
{ title: 'Email', data: 'email', orderable: false },
];
// #t="dtTable" exposes the directive; .instance() is the Api.
table = viewChild.required(DtTableDirective);
toggle(i: number) {
const col = this.table().instance()!.column(i);
col.visible(!col.visible());
}