# ngx-datatable

**ngx-datatable** is the default solution for large and interactive tables. It is open-source software under MIT license and maintained by Siemens.

## Usage

It supports sorting, filtering, paging, selection, virtualization, and keyboard interaction, while remaining flexible about data handling.

![ngx-datatable](<../images/NGX-datatable.png>)

### When to use

- To handle large datasets.
- When sorting, filtering, paging, or selection is required.
- To support column reordering.
- To support empty states (client or server).
- To support server-side filtering and sorting.
- To support grouped or tree rows
- To support row dragging.
- To support sticky columns.
- When looking for a free open-source solution.

## Code

> **Note:** The ngx-datatable implements change detection based on immutable table data. E.g. when only the content of a particular cell has changed, this change is not detected by the ngx change detection. See also the [remark in the ngx-datatable documentation](<https://siemens-com.gitbook.io/ngx-datatable/readme/cd>).

### Usage

`ngx-datatable` is an Angular component for presenting large and complex data. The table is designed to be flexible and light. It doesn't make any assumptions about the data or how you filter, sort or page it. Check out the [full documentation](<https://siemens-com.gitbook.io/ngx-datatable/>), [demos](<http://siemens.github.io/ngx-datatable/>) and the [demo code](<https://github.com/siemens/ngx-datatable/blob/master/src/app>) for more information!

> [!NOTE]
>
> **Required Packages**
>
> - [@siemens/ngx-datatable](<https://www.npmjs.com/package/@siemens/ngx-datatable>)

```
import { NgxDatatableModule } from '@siemens/ngx-datatable';
import { SI_DATATABLE_CONFIG, SiDatatableModule, provideSiDatatableConfig } from '@siemens/element-ng/datatable';

// standalone apps
export const APP_CONFIG: ApplicationConfig = {
  providers: [
    ...
    provideSiDatatableConfig()
    // For smaller row heights:
    // provideSiDatatableConfig({rowHeight: SI_DATATABLE_CONFIG.rowHeightSmall})
  ]
};

// module based apps
@NgModule({
  imports: [
    NgxDatatableModule.forRoot(SI_DATATABLE_CONFIG),
    // For smaller row heights:
    // NgxDatatableModule.forRoot({ ...SI_DATATABLE_CONFIG, rowHeight: SI_DATATABLE_CONFIG.rowHeightSmall }),
    SiDatatableModule,
    // ...
  ]
})
```

#### Style configuration

No additional configuration is necessary as everything is already provided in the Element theme.

### Keyboard interaction

To have the correct keyboard interaction, use the `siDatatableInteraction` directive.

### Right align columns

There is a small but powerful trick how to right align columns with `ngx-datatable`. Notice how the `Age` column is right aligned in the example below. In the TypeScript code you can see that the table columns support two properties called `headerClass` and `cellClass` that can be used to apply a CSS class to the column header as well as the column's body cells:

```
{
  headerClass: 'justify-content-end', // right align column header
  cellClass: 'text-align-right-cell' // right align body cell
}
```

For the `headerClass` you can use the existing [flex](<https://element.siemens.io/fundamentals/styles/flex/>) utility class `justify-content-end` to right align the column header. For the `cellClass` you have to define your own custom class `text-align-right-cell` and add the following SCSS code in your stylesheet:

```
::ng-deep {
  // center align datatable cell
  .text-align-right-cell .datatable-body-cell-label {
    flex: 1;
    text-align: end;
  }
}
```

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiResizeObserverModule } from '@siemens/element-ng/resize-observer';
import { NgxDatatableModule } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiResizeObserverModule],
  templateUrl: './datatable-footer.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;
  rows: any[] = [];

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        age: 10 + (i % 9)
      });
    }
  }
}
```

Template:

```html
<div class="p-5 clearfix si-layout-fixed-height h-100">
  <ngx-datatable
    #table
    class="table-element si-layout-fixed-height"
    columnMode="force"
    siDatatableInteraction
    [rows]="rows"
    [columns]="[
      { name: 'First name', prop: 'firstname' },
      { name: 'Last name', prop: 'lastname' },
      {
        name: 'Age',
        prop: 'age',
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell'
      }
    ]"
    [virtualization]="false"
    [rowHeight]="tableConfig.rowHeightSmall"
    [scrollbarV]="true"
    (siResizeObserver)="table.recalculate()"
  >
    ></ngx-datatable
  >
</div>
```

### Striped rows

Add `table-striped` next to `table-element` on `<ngx-datatable>` to distinguish alternating body rows, like the [HTML table](<https://element.siemens.io/components/lists-tables-trees/html-table/>) variant of the same name.

```
<ngx-datatable class="table-element table-striped">
  <!-- Table content -->
</ngx-datatable>
```

Striping is based on the row index, so it stays stable while scrolling virtualized rows. Hover, selection and focus states take precedence over the striping.

### Client-side paging, sorting and selection options

- Use `class="table-element"` on `<ngx-datatable>`.
- Use the [pagination](<https://element.siemens.io/components/layout-navigation/pagination/>) component as custom footer template with `ngx-datatable-footer` and map inputs and outputs.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { CdkMenuTrigger } from '@angular/cdk/menu';
import { Component, OnInit, TemplateRef, viewChild } from '@angular/core';
import { FormsModule } from '@angular/forms';
import {
  elementAlarmFilled,
  elementCancelFilled,
  elementManualFilled,
  elementOptionsVertical
} from '@siemens/element-icons';
import { SiCircleStatusComponent } from '@siemens/element-ng/circle-status';
import { StatusType } from '@siemens/element-ng/common';
import { SiDatatableInteractionDirective } from '@siemens/element-ng/datatable';
import { SiFormItemComponent, SiFormValidationTooltipDirective } from '@siemens/element-ng/form';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { SiMenuFactoryComponent } from '@siemens/element-ng/menu';
import { SiPaginationComponent } from '@siemens/element-ng/pagination';
import { NgxDatatableModule, SelectionType, TableColumn } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [
    FormsModule,
    NgxDatatableModule,
    SiDatatableInteractionDirective,
    SiPaginationComponent,
    SiCircleStatusComponent,
    SiFormItemComponent,
    SiIconComponent,
    SiMenuFactoryComponent,
    CdkMenuTrigger,
    SiFormValidationTooltipDirective
  ],
  templateUrl: './datatable.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent implements OnInit {
  readonly icons = addIcons({
    elementAlarmFilled,
    elementCancelFilled,
    elementManualFilled,
    elementOptionsVertical
  });
  readonly statusCellTempl = viewChild.required('statusCellTempl', {
    read: TemplateRef<any>
  });
  readonly otherStatusCellTempl = viewChild.required('otherStatusCellTempl', {
    read: TemplateRef<any>
  });
  readonly ageCellTempl = viewChild.required('ageCellTempl', {
    read: TemplateRef<any>
  });
  readonly contextCellTempl = viewChild.required('contextCellTempl', {
    read: TemplateRef<any>
  });
  readonly statusHeaderCellTemplate = viewChild.required('statusHeaderCellTemplate', {
    read: TemplateRef<any>
  });
  readonly contextHeaderCellTemplate = viewChild.required('contextHeaderCellTemplate', {
    read: TemplateRef<any>
  });
  readonly contextItems = [
    { title: 'Items 1', action: () => alert('Item 1') },
    { title: 'Items 2', action: () => alert('Item 2') }
  ];
  readonly statusTypes: StatusType[] = ['success', 'info', 'warning', 'danger'];
  rows: any[] = [];
  columns!: TableColumn[];
  pageNumber = 0;
  // This type is NOT deprecated, but the value is.
  // ESLint does not understand this.
  // eslint-disable-next-line @typescript-eslint/no-deprecated
  selectionType: SelectionType = 'multiClick';
  // eslint-disable-next-line @typescript-eslint/no-deprecated
  selectionTypes: SelectionType[] = ['single', 'multi', 'multiClick', 'cell', 'checkbox'];
  nextStatusType = 0;
  enforceCheckboxes = false;
  striped = false;

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        age: 10 + (i % 9),
        status: this.getStatusType(i)
      });
    }
  }

  ngOnInit(): void {
    this.initTableColumns();
  }

  selectionTypeChanged(enforceCheckboxes: boolean): void {
    this.enforceCheckboxes = enforceCheckboxes;
    this.initTableColumns();
  }

  private get showCheckboxes(): boolean {
    return this.selectionType === 'checkbox' || this.enforceCheckboxes;
  }

  private initTableColumns(): void {
    this.columns = [
      {
        prop: 'user',
        name: '',
        headerTemplate: this.statusHeaderCellTemplate(),
        width: this.showCheckboxes ? 112 : 80,
        resizeable: false,
        canAutoResize: false,
        cellClass: 'overflow-visible',
        cellTemplate: this.statusCellTempl(),
        checkboxable: this.showCheckboxes,
        headerCheckboxable: this.showCheckboxes
      },
      {
        prop: 'id',
        name: 'ID',
        width: 50,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        resizeable: false,
        canAutoResize: false
      },
      {
        prop: 'firstname',
        name: 'First Name',
        minWidth: 100,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'lastname',
        name: 'Last Name',
        minWidth: 100,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'status',
        name: 'Status',
        minWidth: 100,
        resizeable: true,
        canAutoResize: false,
        cellTemplate: this.otherStatusCellTempl()
      },
      {
        prop: 'age',
        name: 'Age',
        width: 200,
        resizeable: false,
        canAutoResize: false,
        cellTemplate: this.ageCellTempl()
      },
      {
        prop: 'context',
        name: '',
        headerTemplate: this.contextHeaderCellTemplate(),
        width: 40,
        resizeable: false,
        canAutoResize: false,
        cellTemplate: this.contextCellTempl()
      }
    ];
  }

  private getStatusType(row: number): StatusType | null {
    if (row % 4 !== 0) {
      return null;
    }
    this.nextStatusType = ++this.nextStatusType % this.statusTypes.length;
    return this.statusTypes[this.nextStatusType];
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column">
  <ngx-datatable
    #table
    class="table-element"
    columnMode="force"
    siDatatableInteraction
    [class.table-striped]="striped"
    [rows]="rows"
    [columns]="columns"
    [reorderable]="true"
    [externalPaging]="false"
    [limit]="8"
    [offset]="pageNumber"
    [selectionType]="selectionType"
    [count]="rows.length"
    [virtualization]="false"
    [scrollbarV]="false"
  >
    <ngx-datatable-footer>
      <ng-template ngx-datatable-footer-template>
        <si-pagination
          class="ms-auto"
          forwardButtonText="forward"
          backButtonText="back"
          [currentPage]="pageNumber + 1"
          [totalRowCount]="rows.length"
          (currentPageChange)="pageNumber = $event - 1"
        />
      </ng-template>
    </ngx-datatable-footer>
  </ngx-datatable>
</div>

<div class="p-5 e2e-ignore">
  <div class="card">
    <div class="card-header">Settings</div>
    <div class="card-body">
      <div class="row">
        <div class="col-4">
          <si-form-item label="Selection type">
            <select
              class="form-control"
              id="selection-type"
              [(ngModel)]="selectionType"
              (ngModelChange)="selectionTypeChanged(enforceCheckboxes)"
            >
              <option [ngValue]="undefined">undefined</option>
              @for (selType of selectionTypes; track $index) {
                <option [ngValue]="selType">{{ selType }}</option>
              }
            </select>
          </si-form-item>
        </div>
        <div class="col-4">
          <si-form-item label="Enforce checkboxes">
            <input
              class="form-check-input"
              type="checkbox"
              [(ngModel)]="enforceCheckboxes"
              (ngModelChange)="selectionTypeChanged($event)"
            />
          </si-form-item>
        </div>
        <div class="col-4">
          <si-form-item label="Striped rows">
            <input class="form-check-input" type="checkbox" [(ngModel)]="striped" />
          </si-form-item>
        </div>
      </div>
    </div>
  </div>
</div>

<!--
  A header name must be always provided for a11y purposes.
  If it shouldn't be visible it can be hidden using a custom header template and the class `visually-hidden`.
  -->
<ng-template #statusHeaderCellTemplate>
  <span class="visually-hidden">Status</span>
</ng-template>

<ng-template #contextHeaderCellTemplate>
  <span class="visually-hidden">Context options</span>
</ng-template>
<ng-template #statusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <si-circle-status icon="element-plant" [status]="row.status" />
</ng-template>
<ng-template #otherStatusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <div class="d-flex gap-1">
    <si-icon class="icon status-danger" [icon]="icons.elementCancelFilled" />
    <si-icon class="icon status-warning" [icon]="icons.elementManualFilled" />
    <si-icon class="icon status-danger" [icon]="icons.elementAlarmFilled" />
  </div>
</ng-template>

<ng-template #ageCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <input
    type="text"
    class="form-control"
    placeholder="Age"
    required
    minlength="2"
    pattern="[0-9]{2}"
    siFormValidationTooltip
    aria-label="Age"
    [ngModel]="row.age"
  />
</ng-template>

<ng-template #contextCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <div role="button" aria-label="Context menu" [cdkMenuTriggerFor]="menu">
    <si-icon class="icon" [icon]="icons.elementOptionsVertical" />
  </div>
</ng-template>

<ng-template #menu>
  <si-menu-factory [items]="contextItems" />
</ng-template>
```

### Server-side paging

Datatable component configured for server-side paging and lazy loading.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, linkedSignal, signal } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiPaginationComponent } from '@siemens/element-ng/pagination';
import { NgxDatatableModule } from '@siemens/ngx-datatable';

import { CorporateEmployee, DataService, Page, PageRequest } from './data.service';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiPaginationComponent],
  templateUrl: './datatable-paging.html',
  styleUrl: './datatable.scss',
  providers: [DataService]
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;

  private dataService = inject(DataService);
  private readonly initialPage = Object.assign(new Page(), { size: 10 });
  private readonly pageRequest = signal<PageRequest | undefined>(undefined);

  readonly dataResource = rxResource({
    params: () => this.pageRequest(),
    stream: ({ params }) => this.dataService.getResults(params)
  });

  readonly page = linkedSignal<Page | undefined, Page>({
    source: () => this.dataResource.value()?.page,
    computation: (page, previous) => page ?? previous?.value ?? this.initialPage
  });
  readonly rows = linkedSignal<CorporateEmployee[] | undefined, CorporateEmployee[]>({
    source: () => this.dataResource.value()?.data,
    computation: (rows, previous) => rows ?? previous?.value ?? []
  });

  setPage(pageRequest: PageRequest): void {
    const currentRequest = this.pageRequest();
    if (
      currentRequest?.offset === pageRequest.offset &&
      currentRequest.pageSize === pageRequest.pageSize
    ) {
      return;
    }

    this.pageRequest.set(pageRequest);
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column">
  <ngx-datatable
    #table
    class="table-element"
    siDatatableInteraction
    columnMode="force"
    [rows]="rows()"
    [columns]="[
      { name: 'Name', sortable: false },
      { name: 'Role', sortable: false },
      { name: 'Company', sortable: false }
    ]"
    [rowHeight]="tableConfig.rowHeightSmall"
    [externalPaging]="true"
    [ghostLoadingIndicator]="dataResource.isLoading()"
    [count]="page().totalElements"
    [offset]="page().pageNumber"
    [limit]="page().size"
    (page)="setPage($event)"
  >
    <ngx-datatable-footer>
      <ng-template ngx-datatable-footer-template>
        <si-pagination
          class="ms-auto"
          forwardButtonText="forward"
          backButtonText="back"
          [currentPage]="page().pageNumber + 1"
          [totalRowCount]="page().totalElements"
          [pageSize]="page().size"
          (currentPageChange)="table.onFooterPage({ page: $event })"
        />
      </ng-template>
    </ngx-datatable-footer>
  </ngx-datatable>
</div>
```

### Vertical scroll

This example shows a table that grows to the maximum available height, using the `layout-fixed-height` class (see also [Content Layouts](<https://element.siemens.io/fundamentals/layouts/content/>)). The property `scrollbarV` is used to enable vertical scrolling within the table. Enabling `scrollbarVDynamic` removes the scrollbar width from the row width only when actually needed.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, OnInit, TemplateRef, viewChild } from '@angular/core';
import { SiCircleStatusModule } from '@siemens/element-ng/circle-status';
import { StatusType } from '@siemens/element-ng/common';
import { SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiEmptyStateComponent } from '@siemens/element-ng/empty-state';
import { SiResizeObserverModule } from '@siemens/element-ng/resize-observer';
import { SiSliderComponent } from '@siemens/element-ng/slider';
import { DatatableComponent, NgxDatatableModule, TableColumn } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [
    NgxDatatableModule,
    SiResizeObserverModule,
    SiDatatableModule,
    SiEmptyStateComponent,
    SiSliderComponent,
    SiCircleStatusModule
  ],
  templateUrl: './datatable-vertical-scrolling.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent implements OnInit {
  readonly table = viewChild(DatatableComponent);
  readonly statusCellTempl = viewChild.required<TemplateRef<any>>('statusCellTempl');

  rows: any[] = [];
  columns!: TableColumn[];

  statusTypes: StatusType[] = ['success', 'info', 'warning', 'danger'];
  nextStatusType = 0;
  slidingValue = 10;

  constructor() {
    this.setupData(this.slidingValue);
  }

  ngOnInit(): void {
    this.initTableColumns();
  }

  setupData(size?: number): void {
    if (size) {
      const data = [];
      for (let i = 1; i <= size; i++) {
        data.push({
          id: i,
          firstname: 'First ' + i,
          lastname: 'Last ' + i,
          age: 10 + (i % 9),
          status: this.getStatusType(i)
        });
      }
      this.rows = data;
    }
  }

  resizeTable(): void {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    setTimeout(() => this.table()?.recalculate());
  }

  private initTableColumns(): void {
    this.columns = [
      {
        prop: 'status',
        name: 'Status',
        width: 100,
        resizeable: false,
        canAutoResize: false,
        cellTemplate: this.statusCellTempl()
      },
      {
        prop: 'id',
        name: 'ID',
        width: 50,
        resizeable: false,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        canAutoResize: false
      },
      {
        prop: 'firstname',
        name: 'First Name',
        minWidth: 100,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'lastname',
        name: 'Last Name',
        minWidth: 100,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'age',
        name: 'Age',
        width: 80,
        resizeable: false,
        canAutoResize: false,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell'
      }
    ];
  }

  private getStatusType(row: number): StatusType | null {
    if (row % 4 !== 0) {
      return null;
    }
    this.nextStatusType = ++this.nextStatusType % this.statusTypes.length;
    return this.statusTypes[this.nextStatusType];
  }
}
```

Template:

```html
<div class="p-5 clearfix si-layout-fixed-height h-100">
  <ngx-datatable
    #table
    class="table-element si-layout-fixed-height"
    columnMode="force"
    siDatatableInteraction
    selectionType="single"
    [rows]="rows"
    [columns]="columns"
    [reorderable]="true"
    [footerHeight]="0"
    [count]="rows.length"
    [scrollbarV]="true"
    [scrollbarVDynamic]="true"
    (siResizeObserver)="resizeTable()"
  >
    >
    <si-empty-state empty-content icon="element-users" heading="No users to display" />
  </ngx-datatable>

  <div class="mt-6 e2e-ignore">
    <si-slider
      [min]="0"
      [max]="100"
      [step]="1"
      [(value)]="slidingValue"
      (valueChange)="setupData($event)"
    />
  </div>
</div>

<ng-template #statusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <si-circle-status icon="element-user" [status]="row.status" />
</ng-template>
```

### Infinite scroll

Datatable component configured for server-side virtual paging. The data is loaded in pages from the server.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, computed, inject, linkedSignal, signal } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiResizeObserverModule } from '@siemens/element-ng/resize-observer';
import { LOG_EVENT } from '@siemens/live-preview';
import { NgxDatatableModule } from '@siemens/ngx-datatable';
import { forkJoin } from 'rxjs';

import { CorporateEmployee, DataService, PagedData, PageRequest } from './data.service';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiResizeObserverModule, SiDatatableModule],
  templateUrl: './datatable-paging-virtual.html',
  styleUrl: './datatable.scss',
  providers: [DataService]
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);

  tableConfig = SI_DATATABLE_CONFIG;
  readonly pageNumber = signal(0);

  private dataService = inject(DataService);
  private readonly pageRequest = signal<PageRequest | undefined>(undefined);

  readonly dataResource = rxResource({
    params: () => this.pageRequest(),
    stream: ({ params }) => {
      const requests = [
        params.offset > 0 ? { ...params, offset: params.offset - 1 } : undefined,
        params,
        { ...params, offset: params.offset + 1 }
      ].filter(request => request !== undefined);
      return forkJoin(requests.map(request => this.dataService.getResults(request)));
    }
  });
  private readonly loadedData = linkedSignal<
    PagedData<CorporateEmployee>[] | undefined,
    { rows: CorporateEmployee[]; totalElements: number }
  >({
    source: this.dataResource.value,
    computation: (pagedDataPages, previous) => {
      if (!pagedDataPages) {
        return previous?.value ?? { rows: [], totalElements: 0 };
      }

      const rows = previous?.value.rows.slice() ?? [];
      for (const pagedData of pagedDataPages) {
        const start = pagedData.page.pageNumber * pagedData.page.size;
        if (rows.length <= start) {
          rows.length = start + 1;
        }
        rows.splice(start, pagedData.page.size, ...pagedData.data);
      }
      return { rows, totalElements: pagedDataPages[0]?.page.totalElements ?? 0 };
    }
  });
  readonly totalElements = computed(() => this.loadedData().totalElements);
  readonly rows = computed(() => this.loadedData().rows);

  onSelect(event: CorporateEmployee[]): void {
    this.logEvent(event);
  }

  setPage(pageRequest: PageRequest): void {
    // current page number is determined by last call to setPage
    this.pageNumber.set(pageRequest.offset);

    const currentRequest = this.pageRequest();
    if (
      currentRequest?.offset === pageRequest.offset &&
      currentRequest.pageSize === pageRequest.pageSize
    ) {
      return;
    }

    this.pageRequest.set(pageRequest);
  }
}
```

Template:

```html
<div class="p-5 h-100">
  <ngx-datatable
    #table
    class="table-element h-100"
    siDatatableInteraction
    columnMode="force"
    selectionType="multi"
    [rows]="rows()"
    [columns]="[
      { name: 'Name', sortable: false },
      { name: 'Role', sortable: false },
      { name: 'Company', sortable: false }
    ]"
    [reorderable]="true"
    [rowHeight]="tableConfig.rowHeightSmall"
    [footerHeight]="0"
    [ghostLoadingIndicator]="true"
    [scrollbarV]="true"
    [externalPaging]="true"
    [externalSorting]="true"
    [count]="totalElements()"
    [offset]="pageNumber()"
    [datatableInteractionAutoSelect]="true"
    (page)="setPage($event)"
    (selectedChange)="onSelect($event)"
    (siResizeObserver)="table.recalculate()"
  />
</div>
```

### Empty state

Use the `<si-empty-state></si-empty-state>` for an empty table.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiEmptyStateComponent } from '@siemens/element-ng/empty-state';
import { NgxDatatableModule } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiEmptyStateComponent],
  templateUrl: './datatable-empty-custom.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;
}
```

Template:

```html
<div class="p-5 clearfix">
  <ngx-datatable
    #table
    class="table-element"
    siDatatableInteraction
    [rows]="[]"
    [columns]="[
      { name: 'Name', sortable: false },
      { name: 'Role', sortable: false },
      { name: 'Company', sortable: false }
    ]"
    [footerHeight]="0"
    [rowHeight]="tableConfig.rowHeightSmall"
    [externalPaging]="false"
    [count]="0"
    [offset]="0"
    [limit]="10"
  >
    <si-empty-state empty-content icon="element-technical-operator" heading="No data to display" />
  </ngx-datatable>
</div>
```

### Selection

Datatable with a selection. Use the `datatableInteractionAutoSelect` input of the `siDatatableInteraction` directive to have it automatically select on keyboard navigation.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SiCardComponent } from '@siemens/element-ng/card';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiFormModule } from '@siemens/element-ng/form';
import { NgxDatatableModule, SelectionType } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiCardComponent, SiFormModule, FormsModule],
  templateUrl: './datatable-selection.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;

  selected: any[] = [];
  rows: any[] = [];

  // eslint-disable-next-line @typescript-eslint/no-deprecated
  selectionTypes: SelectionType[] = ['single', 'multi', 'multiClick', 'checkbox', 'cell'];
  // eslint-disable-next-line @typescript-eslint/no-deprecated
  selectionType: SelectionType | undefined;

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        age: 10 + (i % 9)
      });
    }
  }
}
```

Template:

```html
<div class="container">
  <div class="row">
    <div class="col-sm p-5 h-100">
      <ngx-datatable
        class="table-element"
        style="height: 500px"
        siDatatableInteraction
        columnMode="force"
        [selectionType]="selectionType!"
        [rows]="rows"
        [columns]="[
          {
            name: 'First name',
            prop: 'firstname',
            checkboxable: selectionType === 'checkbox',
            headerCheckboxable: selectionType === 'checkbox'
          },
          { name: 'Last name', prop: 'lastname' },
          {
            name: 'Age',
            prop: 'age',
            headerClass: 'justify-content-end',
            cellClass: 'text-align-right-cell'
          }
        ]"
        [summaryRow]="selectionType === 'single'"
        [summaryHeight]="tableConfig.summaryHeight"
        [rowHeight]="tableConfig.rowHeightSmall"
        [footerHeight]="0"
        [virtualization]="false"
        [scrollbarV]="true"
        [datatableInteractionAutoSelect]="true"
        [(selected)]="selected"
      />
    </div>
    <div class="col-sm p-5">
      <si-card heading="Selection">
        <div class="card-body" body>
          @for (item of selected; track item) {
            <div class="mb-2">
              {{ item.firstname + ' ' + item.lastname + ' - ' + item.age }}
            </div>
          } @empty {
            None
          }
        </div>
      </si-card>
      <si-card class="mt-4" heading="Selection type">
        <div class="card-body" body>
          <div class="row">
            <div class="col-6">
              <si-form-item label="Selection type">
                <select class="form-control" id="selection-type" [(ngModel)]="selectionType">
                  <option [ngValue]="undefined">Choose selection type</option>
                  @for (selType of selectionTypes; track $index) {
                    <option [ngValue]="selType">{{ selType }}</option>
                  }
                </select>
              </si-form-item>
            </div>
          </div>
        </div>
      </si-card>
    </div>
  </div>
</div>
```

### Filter and sort

#### Example

##### Server side

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, computed, inject, signal, viewChild } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiEmptyStateComponent } from '@siemens/element-ng/empty-state';
import { DatatableComponent, NgxDatatableModule, SortPropDir } from '@siemens/ngx-datatable';

import { DataService, PageRequest } from './data.service';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiEmptyStateComponent],
  templateUrl: './datatable-filter-sort-server.html',
  styleUrl: './datatable.scss',
  providers: [DataService]
})
export class SampleComponent {
  readonly table = viewChild(DatatableComponent);

  tableConfig = SI_DATATABLE_CONFIG;

  offset = 0;

  private dataService = inject(DataService);
  private readonly pageRequest = signal<PageRequest>({ offset: 0, pageSize: 50 });

  readonly dataResource = rxResource({
    params: () => this.pageRequest(),
    stream: ({ params }) => this.dataService.getResults(params)
  });

  readonly rows = computed(() => {
    const data = this.dataResource.value();
    // The ghost loading indicator styles existing rows, so provide five placeholders until data arrives.
    return data?.data ?? [].constructor(5);
  });

  fetchData(pageRequest: PageRequest): void {
    const table = this.table();
    if (table) {
      // Whenever the filter changes, always go back to the first page
      this.offset = 0;
    }
    this.pageRequest.set(pageRequest);
  }

  updateFilter(event: any): void {
    const val = event.target.value.toLowerCase();
    this.fetchData({ offset: 0, pageSize: 50, filter: val });
  }
  onSort(sorts: SortPropDir[]): void {
    this.fetchData({ offset: 0, pageSize: 50, sort: sorts[0] });
  }
}
```

Template:

```html
<div class="p-5 h-100">
  <div class="mb-4 col-sm-4">
    <input
      type="text"
      class="form-control"
      placeholder="Type to filter the name column..."
      (keyup)="updateFilter($event)"
    />
  </div>
  <ngx-datatable
    class="table-element"
    siDatatableInteraction
    columnMode="force"
    [rows]="rows()"
    [offset]="offset"
    [columns]="[
      { name: 'Name', sortable: true },
      { name: 'Role', sortable: true },
      { name: 'Company', sortable: true }
    ]"
    [rowHeight]="tableConfig.rowHeightSmall"
    [footerHeight]="0"
    [ghostLoadingIndicator]="dataResource.isLoading()"
    [externalSorting]="true"
    (sortsChange)="onSort($event)"
  >
    <si-empty-state empty-content icon="element-users" heading="No users to display" />
  </ngx-datatable>
</div>
```

##### Client side

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, computed, inject, signal, viewChild } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiEmptyStateComponent } from '@siemens/element-ng/empty-state';
import { DatatableComponent, NgxDatatableModule } from '@siemens/ngx-datatable';

import { CorporateEmployee, DataService, PageRequest } from './data.service';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiEmptyStateComponent],
  templateUrl: './datatable-filter.html',
  styleUrl: './datatable.scss',
  providers: [DataService]
})
export class SampleComponent {
  readonly table = viewChild.required(DatatableComponent);

  tableConfig = SI_DATATABLE_CONFIG;

  offset = 0;

  private dataService = inject(DataService);
  private readonly pageRequest = signal<PageRequest>({ offset: 0, pageSize: 50 });
  private readonly filterValue = signal<string>('');

  readonly dataResource = rxResource({
    params: () => this.pageRequest(),
    stream: ({ params }) => this.dataService.getResults(params)
  });

  readonly rows = computed(() => {
    const data = this.dataResource.value();
    // The ghost loading indicator styles existing rows, so provide five placeholders until data arrives.
    const allRows: CorporateEmployee[] = data?.data ?? [].constructor(5);
    const filter = this.filterValue().toLowerCase();

    if (!filter) {
      return allRows;
    }

    // filter our data
    return allRows.filter(e => e.name.toLowerCase().includes(filter));
  });

  fetchData(pageRequest: PageRequest): void {
    this.pageRequest.set(pageRequest);
  }

  updateFilter(event: any): void {
    const val = event.target.value.toLowerCase();
    this.filterValue.set(val);

    // Whenever the filter changes, always go back to the first page
    this.offset = 0;
  }
}
```

Template:

```html
<div class="p-5 h-100">
  <div class="mb-4 col-sm-4">
    <input
      type="text"
      class="form-control"
      id="exampleInput"
      placeholder="Type to filter the name column..."
      (keyup)="updateFilter($event)"
    />
  </div>
  <ngx-datatable
    class="table-element"
    siDatatableInteraction
    columnMode="force"
    [rows]="rows()"
    [columns]="[
      { name: 'Name', sortable: true },
      { name: 'Role', sortable: true },
      { name: 'Company', sortable: true }
    ]"
    [rowHeight]="tableConfig.rowHeightSmall"
    [footerHeight]="0"
    [ghostLoadingIndicator]="dataResource.isLoading()"
    [(offset)]="offset"
  >
    <si-empty-state empty-content icon="element-users" heading="No users to display" />
  </ngx-datatable>
</div>
```

### Responsive

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { CdkMenuTrigger } from '@angular/cdk/menu';
import { Component, OnDestroy, OnInit, TemplateRef, viewChild } from '@angular/core';
import {
  elementAlarmFilled,
  elementCancelFilled,
  elementManualFilled,
  elementOptionsVertical
} from '@siemens/element-icons';
import { SiCircleStatusModule } from '@siemens/element-ng/circle-status';
import { StatusType } from '@siemens/element-ng/common';
import { SiDatatableModule } from '@siemens/element-ng/datatable';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { SiMenuFactoryComponent } from '@siemens/element-ng/menu';
import { SiPaginationComponent } from '@siemens/element-ng/pagination';
import {
  BOOTSTRAP_BREAKPOINTS,
  ElementDimensions,
  SiResizeObserverModule
} from '@siemens/element-ng/resize-observer';
import { NgxDatatableModule, TableColumn } from '@siemens/ngx-datatable';
import { Subject } from 'rxjs';

@Component({
  selector: 'app-sample',
  imports: [
    NgxDatatableModule,
    SiDatatableModule,
    SiPaginationComponent,
    SiResizeObserverModule,
    SiCircleStatusModule,
    SiIconComponent,
    SiMenuFactoryComponent,
    CdkMenuTrigger
  ],
  templateUrl: './datatable-responsive.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent implements OnInit, OnDestroy {
  readonly icons = addIcons({
    elementAlarmFilled,
    elementCancelFilled,
    elementManualFilled,
    elementOptionsVertical
  });
  readonly statusCellTempl = viewChild.required<TemplateRef<any>>('statusCellTempl');
  readonly otherStatusCellTempl = viewChild.required<TemplateRef<any>>('otherStatusCellTempl');
  readonly contextCellTempl = viewChild.required<TemplateRef<any>>('contextCellTempl');

  rows: any[] = [];
  columns!: TableColumn[];
  allColumns!: TableColumn[];
  pageNumber = 0;

  noSelection = false;
  statusTypes: StatusType[] = ['success', 'info', 'warning', 'danger'];
  nextStatusType = 0;
  enforceCheckboxes = false;
  contextItems = [
    { title: 'Items 1', action: () => alert('Item 1') },
    { title: 'Items 2', action: () => alert('Item 2') }
  ];

  private destroy = new Subject<boolean>();

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        address: 'Siemens',
        age: 10 + (i % 9),
        status: this.getStatusType(i)
      });
    }
  }

  ngOnInit(): void {
    this.initTableColumns();
  }

  ngOnDestroy(): void {
    this.destroy.next(true);
    this.destroy.complete();
  }

  private initTableColumns(): void {
    this.columns = [
      {
        prop: 'user',
        name: '',
        width: 80,
        resizeable: false,
        canAutoResize: false,
        cellTemplate: this.statusCellTempl()
      },
      {
        prop: 'id',
        name: 'ID',
        width: 50,
        resizeable: false,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        canAutoResize: false
      },
      {
        prop: 'firstname',
        name: 'First Name',
        minWidth: 100,
        width: 200,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'lastname',
        name: 'Last Name',
        minWidth: 100,
        width: 200,
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'status',
        name: 'Status',
        minWidth: 100,
        resizeable: true,
        canAutoResize: true,
        cellTemplate: this.otherStatusCellTempl()
      },
      {
        prop: 'age',
        name: 'Age',
        minWidth: 100,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        resizeable: true,
        canAutoResize: true
      },
      {
        prop: 'context',
        name: '',
        width: 40,
        minWidth: 40,
        resizeable: false,
        canAutoResize: false,
        cellTemplate: this.contextCellTempl(),
        cellClass: 'text-align-center-cell'
      }
    ];

    this.allColumns = [...this.columns];
  }

  private getStatusType(row: number): StatusType | null {
    if (row % 4 !== 0) {
      return null;
    }
    this.nextStatusType = ++this.nextStatusType % this.statusTypes.length;
    return this.statusTypes[this.nextStatusType];
  }

  protected tableResize(event: ElementDimensions): void {
    switch (true) {
      case event.width <= BOOTSTRAP_BREAKPOINTS.smMinimum:
        this.columns = [this.allColumns[2], this.allColumns[3]];
        break;
      case event.width > BOOTSTRAP_BREAKPOINTS.smMinimum &&
        event.width <= BOOTSTRAP_BREAKPOINTS.mdMinimum:
        this.columns = [
          this.allColumns[1],
          this.allColumns[2],
          this.allColumns[3],
          this.allColumns[4]
        ];
        break;
      case event.width > BOOTSTRAP_BREAKPOINTS.mdMinimum &&
        event.width <= BOOTSTRAP_BREAKPOINTS.lgMinimum:
        this.columns = [
          this.allColumns[1],
          this.allColumns[2],
          this.allColumns[3],
          this.allColumns[4],
          this.allColumns[5]
        ];
        break;
      case event.width > BOOTSTRAP_BREAKPOINTS.lgMinimum &&
        event.width <= BOOTSTRAP_BREAKPOINTS.xlMinimum:
        this.columns = [
          this.allColumns[0],
          this.allColumns[1],
          this.allColumns[2],
          this.allColumns[3],
          this.allColumns[4],
          this.allColumns[5]
        ];
        break;
      case event.width > BOOTSTRAP_BREAKPOINTS.xlMinimum &&
        event.width <= BOOTSTRAP_BREAKPOINTS.xxlMinimum:
        this.columns = this.allColumns;
        break;
      default:
        this.columns = this.allColumns;
    }
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column">
  <ngx-datatable
    #table
    class="table-element"
    columnMode="force"
    siDatatableInteraction
    selectionType="multiClick"
    [rows]="rows"
    [columns]="columns"
    [reorderable]="true"
    [externalPaging]="false"
    [limit]="8"
    [offset]="pageNumber"
    [count]="rows.length"
    [scrollbarH]="false"
    [virtualization]="false"
    [scrollbarV]="false"
    (siResizeObserver)="tableResize($event)"
  >
    <ngx-datatable-footer>
      <ng-template ngx-datatable-footer-template>
        <si-pagination
          class="ms-auto"
          forwardButtonText="forward"
          backButtonText="back"
          [currentPage]="pageNumber + 1"
          [totalRowCount]="rows.length"
          (currentPageChange)="pageNumber = $event - 1"
        />
      </ng-template>
    </ngx-datatable-footer>
  </ngx-datatable>
</div>

<ng-template #statusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <si-circle-status icon="element-plant" [status]="row.status" />
</ng-template>
<ng-template #otherStatusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <div class="d-flex gap-1">
    <si-icon class="icon status-danger" [icon]="icons.elementCancelFilled" />
    <si-icon class="icon status-warning" [icon]="icons.elementManualFilled" />
    <si-icon class="icon status-danger" [icon]="icons.elementAlarmFilled" />
  </div>
</ng-template>

<ng-template #contextCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <div role="button" aria-label="Context menu" [cdkMenuTriggerFor]="menu">
    <si-icon class="icon" [icon]="icons.elementOptionsVertical" />
  </div>
</ng-template>

<ng-template #menu>
  <si-menu-factory [items]="contextItems" />
</ng-template>
```

### Fix height

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, linkedSignal, signal } from '@angular/core';
import { rxResource } from '@angular/core/rxjs-interop';
import { FormsModule } from '@angular/forms';
import { SiCardComponent } from '@siemens/element-ng/card';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiPaginationComponent } from '@siemens/element-ng/pagination';
import { NgxDatatableModule } from '@siemens/ngx-datatable';

import { CorporateEmployee, DataService, Page, PageRequest } from './data.service';

@Component({
  selector: 'app-sample',
  imports: [
    NgxDatatableModule,
    SiCardComponent,
    SiDatatableModule,
    SiPaginationComponent,
    FormsModule
  ],
  templateUrl: './datatable-fixed-height.html',
  styleUrl: './datatable.scss',
  providers: [DataService]
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;
  tableSize = 500;

  private dataService = inject(DataService);
  private readonly initialPage = Object.assign(new Page(), { size: this.calculatePageSize() });
  private readonly pageRequest = signal<PageRequest | undefined>(undefined);

  readonly dataResource = rxResource({
    params: () => this.pageRequest(),
    stream: ({ params }) => this.dataService.getResults(params)
  });

  readonly page = linkedSignal<Page | undefined, Page>({
    source: () => this.dataResource.value()?.page,
    computation: (page, previous) => page ?? previous?.value ?? this.initialPage
  });
  readonly rows = linkedSignal<CorporateEmployee[] | undefined, CorporateEmployee[]>({
    source: () => this.dataResource.value()?.data,
    computation: (rows, previous) => rows ?? previous?.value ?? []
  });

  setPage(pageRequest: PageRequest): void {
    const currentRequest = this.pageRequest();
    if (
      currentRequest?.offset === pageRequest.offset &&
      currentRequest.pageSize === pageRequest.pageSize
    ) {
      return;
    }

    this.pageRequest.set(pageRequest);
  }

  onTableSizeChange(): void {
    this.page.update(page => Object.assign(new Page(), page, { size: this.calculatePageSize() }));
  }

  private calculatePageSize(): number {
    return Math.floor(
      (this.tableSize - this.tableConfig.headerHeight - this.tableConfig.footerHeight) /
        this.tableConfig.rowHeightSmall
    );
  }
}
```

Template:

```html
<div class="d-flex">
  <si-card class="m-4 px-0 w-50" [heading]="'Table with fix height of ' + tableSize + 'px'">
    <div class="card-body px-0" body>
      <ngx-datatable
        #table
        class="table-element si-layout-fixed-height"
        siDatatableInteraction
        columnMode="force"
        [style.height]="tableSize + 'px'"
        [rows]="rows()"
        [columns]="[
          { name: 'Name', sortable: false },
          { name: 'Role', sortable: false },
          { name: 'Company', sortable: false }
        ]"
        [footerHeight]="0"
        [rowHeight]="tableConfig.rowHeightSmall"
        [externalPaging]="true"
        [ghostLoadingIndicator]="dataResource.isLoading()"
        [count]="page().totalElements"
        [offset]="page().pageNumber"
        [limit]="page().size"
        (page)="setPage($event)"
      />
      <si-pagination
        class="mt-2 float-end"
        forwardButtonText="forward"
        backButtonText="back"
        [currentPage]="page().pageNumber + 1"
        [totalRowCount]="page().totalElements"
        [pageSize]="page().size"
        (currentPageChange)="table.onFooterPage({ page: $event })"
      />
    </div>
  </si-card>
  <div class="w-50 px-8">
    <label for="height-selector">Table height</label>
    <div>
      <select
        value="base-1"
        class="form-control"
        id="height-selector"
        [(ngModel)]="tableSize"
        (change)="onTableSizeChange()"
      >
        <option value="300">300</option>
        <option selected value="500">500</option>
        <option value="800">800</option>
        <option value="1000">1000</option>
      </select>
    </div>
  </div>
</div>
```

### Sticky columns with horizontal scroll

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, OnInit, TemplateRef, viewChild } from '@angular/core';
import { SiCircleStatusModule } from '@siemens/element-ng/circle-status';
import { StatusType } from '@siemens/element-ng/common';
import { SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiPaginationComponent } from '@siemens/element-ng/pagination';
import { NgxDatatableModule, TableColumn } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiPaginationComponent, SiCircleStatusModule],
  templateUrl: './datatable-sticky-columns.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent implements OnInit {
  readonly statusCellTempl = viewChild.required<TemplateRef<any>>('statusCellTempl');

  rows: any[] = [];
  columns!: TableColumn[];
  pageNumber = 0;

  noSelection = false;
  statusTypes: StatusType[] = ['success', 'info', 'warning', 'danger'];
  nextStatusType = 0;
  contextItems = [
    { title: 'Items 1', action: () => alert('Item 1') },
    { title: 'Items 2', action: () => alert('Item 2') }
  ];

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        company: 'Siemens',
        address: `Siemens, Germany`,
        age: 10 + (i % 9),
        status: this.getStatusType(i)
      });
    }
  }

  ngOnInit(): void {
    this.initTableColumns();
  }

  private initTableColumns(): void {
    this.columns = [
      {
        prop: 'user',
        name: '',
        width: 80,
        resizeable: true,
        canAutoResize: false,
        cellTemplate: this.statusCellTempl(),
        checkboxable: false,
        headerCheckboxable: false,
        frozenLeft: true
      },
      {
        prop: 'id',
        name: 'ID',
        width: 50,
        resizeable: true,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        canAutoResize: false,
        frozenLeft: true
      },
      {
        prop: 'firstname',
        name: 'First Name',
        width: 150,
        resizeable: true,
        canAutoResize: false
      },
      {
        prop: 'lastname',
        name: 'Last Name',
        width: 150,
        resizeable: true,
        canAutoResize: false
      },
      {
        prop: 'company',
        name: 'Company',
        width: 150,
        resizeable: true,
        canAutoResize: false
      },
      {
        prop: 'address',
        name: 'Address',
        width: 600,
        resizeable: true,
        canAutoResize: false
      },
      {
        prop: 'age',
        name: 'Age',
        width: 50,
        headerClass: 'justify-content-end',
        cellClass: 'text-align-right-cell',
        resizeable: true,
        canAutoResize: false
      }
    ];
  }

  private getStatusType(row: number): StatusType | null {
    if (row % 4 !== 0) {
      return null;
    }
    this.nextStatusType = ++this.nextStatusType % this.statusTypes.length;
    return this.statusTypes[this.nextStatusType];
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column">
  <ngx-datatable
    #table
    class="table-element"
    columnMode="force"
    siDatatableInteraction
    selectionType="multiClick"
    [rows]="rows"
    [columns]="columns"
    [reorderable]="true"
    [externalPaging]="false"
    [limit]="8"
    [offset]="pageNumber"
    [count]="rows.length"
    [scrollbarH]="true"
    [virtualization]="false"
    [scrollbarV]="false"
  >
    <ngx-datatable-footer>
      <ng-template ngx-datatable-footer-template>
        <si-pagination
          class="ms-auto"
          forwardButtonText="forward"
          backButtonText="back"
          [currentPage]="pageNumber + 1"
          [totalRowCount]="rows.length"
          (currentPageChange)="pageNumber = $event - 1"
        />
      </ng-template>
    </ngx-datatable-footer>
  </ngx-datatable>
</div>

<ng-template #statusCellTempl let-value="value" let-row="row" ngx-datatable-cell-template>
  <si-circle-status icon="element-plant" [status]="row.status" />
</ng-template>
```

### Reordering rows using Angular CDK Drag and Drop

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { CdkDragDrop, DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
import { DatePipe } from '@angular/common';
import { Component } from '@angular/core';
// eslint-disable-next-line no-restricted-imports
import { TranslatePipe } from '@ngx-translate/core';
import { elementMenu } from '@siemens/element-icons';
import { addIcons, SiIconComponent } from '@siemens/element-ng/icon';
import { DatatableRowDefDirective, NgxDatatableModule } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [
    NgxDatatableModule,
    DatatableRowDefDirective,
    DragDropModule,
    TranslatePipe,
    DatePipe,
    SiIconComponent
  ],
  templateUrl: './datatable-row-dragging.html',
  host: { class: 'p-5' }
})
export class SampleComponent {
  icons = addIcons({ elementMenu });
  taskData = [
    {
      id: 1,
      priority: 1,
      task: 'Complete project proposal',
      deadline: 'July 28, 2023',
      status: 'In Progress',
      assignee: 'John Smith',
      department: 'Marketing'
    },
    {
      id: 2,
      priority: 2,
      task: 'Review client feedback',
      deadline: 'July 30, 2023',
      status: 'Not Started',
      assignee: 'Sarah Johnson',
      department: 'Customer Relations'
    },
    {
      id: 3,
      priority: 3,
      task: 'Update documentation',
      deadline: 'August 2, 2023',
      status: 'Not Started',
      assignee: 'Michael Chen',
      department: 'Development'
    },
    {
      id: 4,
      priority: 4,
      task: 'Prepare presentation slides',
      deadline: 'August 5, 2023',
      status: 'Not Started',
      assignee: 'Emily Rodriguez',
      department: 'Marketing'
    },
    {
      id: 5,
      priority: 5,
      task: 'Schedule team meeting',
      deadline: 'July 27, 2023',
      status: 'Completed',
      assignee: 'David Wilson',
      department: 'Operations'
    }
  ];

  protected isCompletedRow(row: unknown): boolean {
    type TaskDataRow = (typeof this.taskData)[number];
    return (row as TaskDataRow).status === 'Completed';
  }

  protected drop(event: CdkDragDrop<any>): void {
    moveItemInArray(this.taskData, event.previousIndex, event.currentIndex);
    this.taskData = [...this.taskData.map((item, index) => ({ ...item, priority: index + 1 }))];
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column">
  <ngx-datatable
    #table
    cdkDropList
    class="table-element"
    siDatatableInteraction
    columnMode="force"
    [rows]="taskData"
    (cdkDropListDropped)="drop($event)"
  >
    <ngx-datatable-column maxWidth="50" sortable="false">
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div cdkDragHandle class="d-flex align-items-center">
          <si-icon class="icon" [icon]="icons.elementMenu" />
        </div>
      </ng-template>
    </ngx-datatable-column>

    <ngx-datatable-column
      minWidth="200"
      sortable="false"
      [name]="'DATATABLE.HEADER.TASK' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.task }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column
      minWidth="100"
      sortable="false"
      [name]="'DATATABLE.HEADER.ASSIGNEE' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.assignee }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column
      minWidth="100"
      sortable="false"
      [name]="'DATATABLE.HEADER.STATUS' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.status }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column
      maxWidth="100"
      minWidth="100"
      sortable="false"
      [name]="'DATATABLE.HEADER.DUE-DATE' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.deadline | date }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column
      minWidth="150"
      sortable="false"
      [name]="'DATATABLE.HEADER.DEPARTMENT' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.department }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>

    <ngx-datatable-column
      maxWidth="150"
      minWidth="100"
      sortable="false"
      [name]="'DATATABLE.HEADER.PRIORITY' | translate"
    >
      <ng-template let-row="row" ngx-datatable-cell-template>
        <div>
          <span>{{ row.priority }}</span>
        </div>
      </ng-template>
    </ngx-datatable-column>

    <ng-template let-row="row" rowDef>
      <datatable-row-def
        cdkDrag
        cdkDragPreviewContainer="parent"
        preserveColumnWidthsOnClone
        [cdkDragDisabled]="isCompletedRow(row)"
      />
    </ng-template>
  </ngx-datatable>
</div>
```

### Column management

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { ChangeDetectorRef, Component, DestroyRef, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
  Column,
  ColumnSelectionDialogResult,
  SiColumnSelectionDialogService
} from '@siemens/element-ng/column-selection-dialog';
import { SI_DATATABLE_CONFIG, SiDatatableModule } from '@siemens/element-ng/datatable';
import { SiResizeObserverModule } from '@siemens/element-ng/resize-observer';
import { LOG_EVENT } from '@siemens/live-preview';
import { NgxDatatableModule, TableColumn } from '@siemens/ngx-datatable';

@Component({
  selector: 'app-sample',
  imports: [NgxDatatableModule, SiDatatableModule, SiResizeObserverModule],
  templateUrl: './datatable-column-reorder.html',
  styleUrl: './datatable.scss'
})
export class SampleComponent {
  tableConfig = SI_DATATABLE_CONFIG;
  rows: any[] = [];
  private siColumnModal = inject(SiColumnSelectionDialogService);
  private logEvent = inject(LOG_EVENT);
  columns: TableColumn[] = [
    { name: 'First name', prop: 'firstname', width: 100 },
    { name: 'Last name', prop: 'lastname', width: 100 },
    {
      name: 'Age',
      prop: 'age',
      headerClass: 'justify-content-end',
      cellClass: 'text-align-right-cell',
      maxWidth: 100
    },
    { name: 'Address', prop: 'address', width: 500 }
  ];

  modalColumns: Column[] = [
    {
      id: 'firstname',
      title: 'First Name',
      visible: true,
      draggable: true,
      disabled: false
    },
    {
      id: 'lastname',
      title: 'Last Name',
      visible: true,
      draggable: true,
      disabled: false
    },
    {
      id: 'age',
      title: 'Age',
      visible: true,
      draggable: true,
      disabled: false
    },
    {
      id: 'address',
      title: 'Address',
      visible: true,
      draggable: true,
      disabled: false
    }
  ];

  private originalModalColumns = this.modalColumns.map(col => ({ ...col }));
  private originalColumns = this.columns.map(col => ({ ...col }));
  private destroyer = inject(DestroyRef);
  private cdRef = inject(ChangeDetectorRef);

  constructor() {
    for (let i = 1; i <= 250; i++) {
      this.rows.push({
        id: i,
        firstname: 'First ' + i,
        lastname: 'Last ' + i,
        age: 10 + (i % 9),
        address:
          'The quick brown fox jumps over the lazy dog repeatedly throughout the misty morning hours. Meanwhile, distant mountains cast long shadows across the peaceful valley below. Ancient trees whisper secrets to the gentle breeze that carries the scent of wildflowers from meadows far away. ' +
          i
      });
    }
  }

  private updateColumns(updatedColumns: Column[]): void {
    // Create a map of the original columns for easy lookup
    const columnMap = new Map(this.originalColumns.map(col => [col.prop, col]));

    // Reorder the columns array based on the order from updatedColumns
    // Only include visible columns in the final array
    this.columns = updatedColumns
      .filter(col => col.visible)
      .map(col => columnMap.get(col.id))
      .filter(col => col !== undefined);

    // Update the modalColumns to reflect the new state
    this.modalColumns = updatedColumns;
  }

  protected showColumnSelectionDialog(): void {
    this.siColumnModal
      .showColumnSelectionDialog({
        heading: 'Customize columns',
        bodyTitle: 'Customize view by selecting or ordering',
        columns: this.modalColumns,
        restoreEnabled: true,
        columnVisibilityConfigurable: true
      })
      .pipe(takeUntilDestroyed(this.destroyer))
      .subscribe((result: ColumnSelectionDialogResult) => {
        switch (result.type) {
          case 'ok':
            {
              this.logEvent('Column selection submitted');
              const updatedColumns = result.columns;
              this.updateColumns(updatedColumns);
            }
            break;
          case 'restoreDefault':
            this.modalColumns = this.originalModalColumns.map(col => ({ ...col }));
            result.updateColumns?.(this.modalColumns);
            break;
        }
        this.cdRef.markForCheck();
      });
  }
}
```

Template:

```html
<div class="p-5 d-flex flex-column h-100">
  <div class="mb-5">
    <button type="button" class="btn btn-secondary" (click)="showColumnSelectionDialog()">
      Reorder columns
    </button>
  </div>
  <ngx-datatable
    #table
    class="table-element si-layout-fixed-height"
    columnMode="force"
    siDatatableInteraction
    [rows]="rows"
    [columns]="columns"
    [scrollbarV]="true"
    [footerHeight]="0"
    (siResizeObserver)="table.recalculate()"
  />
</div>
```

### Resizing

Datatables do have a fixed, automatically updated size, assumed during their initial rendering and refreshed during screen-size changes. However, they are not automatically refreshed in case their parent container changes size. It is the responsibility of a consuming application to invoke a recalculation if such an event occurs. Such a recalculation can be initiated by using the `recalculate()` function, exposed by the component.

```
// ...

@ViewChild(DatatableComponent) table?: DatatableComponent;

// ...

resizeTable() {
  setTimeout(() => this.table?.recalculate());
}
```

> **Note:** For the component to obtain the correct size information, the recalculation has to happen after the actual resizing event. To ensure that, the `setTimeout()` has to be used.

The recalculation can either be triggered whenever changes on the DOM are made (e.g. when panels are collapsed/expanded) or by using Element's `siResizeObserver` directive. If you use `siResizeObserver` directive ensure that you have imported `SiResizeObserverDirective` in your standalone component or module.

```
<ngx-datatable (siResizeObserver)="resizeTable()" ...></ngx-datatable>
```

### DatatableComponent

**Kind:** component

**Selector:** `ngx-datatable`

```
component DatatableComponent<TRow extends Row = any> implements DoCheck, AfterViewInit, OnDestroy
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| checkRowListChanges | `boolean` |  | Controls whether the datatable runs an [IterableDiffer](<https://angular.dev/api/core/IterableDiffer>) against the `rows` input on every change detection cycle to detect additions, removals and reorderings that happen in-place on the same array reference.<br><br>Enabled by default. Set to `false` as a performance optimization when you always pass a new `rows` array reference on updates. |
| checkRowPropertyChanges | `boolean` |  | Controls whether each rendered row runs a [KeyValueDiffer](<https://angular.dev/api/core/KeyValueDiffer>) against its row object on every change detection cycle to detect in-place property mutations (e.g. `row.name = 'new'` without replacing the row reference).<br><br>Enabled by default. Set to `false` as a performance optimization when row objects are treated as immutable. |
| columnMode | `ColumnMode` |  | Column width distribution mode. `standard` uses configured widths, `flex` uses the flex-grow algorithm, and `force` distributes space proportionally. |
| columns | `TableColumn<any>[] \| undefined` |  | Columns to be displayed. |
| count | `number` |  | The total count of all rows. Default value: `0` |
| cssClasses | `Partial<NgxDatatableCssClasses>` |  | CSS class overrides for sort and pager icons. |
| disableRowCheck | `((row: TRow) => boolean) \| undefined` |  | A function you can use to check whether you want to disable a row. Example:<br><br>(row) =\> { return row.name !== 'Ethel Price'; } |
| displayCheck | `((row: TRow, column: TableColumn, value?: any) => boolean) \| undefined` |  | A function you can use to check whether you want to show the checkbox for a particular row based on a criteria. Example:<br><br>(row, column, value) =\> { return row.name !== 'Ethel Price'; } |
| enableClearingSortState | `boolean` |  | A flag to controll behavior of sort states. By default sort on column toggles between ascending and descending without getting removed. Set true to clear sorting of column after performing ascending and descending sort on that column. |
| externalPaging | `boolean` |  | If the table should use external paging otherwise its assumed that all data is preloaded. |
| externalSorting | `boolean` |  | If the table should use external sorting or the built-in basic sorting. |
| footerHeight | `number` |  | The minimum footer height in pixels. Pass falsey for no footer |
| ghostLoadingIndicator | `boolean` |  | Show ghost loaders on each cell. Default value: `false` |
| groupedRows | `Group<TRow>[] \| undefined` |  | This attribute allows the user to set a grouped array in the following format: \[ {groupid=1} \[ {id=1 name="test1"}, {id=2 name="test2"}, {id=3 name="test3"} \]}, {groupid=2\>\[ {id=4 name="test4"}, {id=5 name="test5"}, {id=6 name="test6"} \]} \] |
| groupExpansionDefault | `boolean` |  | A boolean you can use to set the detault behaviour of rows and groups whether they will start expanded or not. If ommited the default is NOT expanded. |
| groupRowsBy | `keyof TRow \| undefined` |  | This attribute allows the user to set the name of the column to group the data with |
| headerHeight | `number \| "auto"` |  | The minimum header height in pixels. Pass a falsey for no header |
| limit | `number \| undefined` |  | The page size to be shown. Default value: `undefined` |
| loadingIndicator | `boolean` |  | Show the linear loading bar. Default value: `false` |
| messages | `Partial<NgxDatatableMessages>` | `{   emptyMessage: 'No data to display',   totalMessage: 'total',   selectedMessage: 'selected',   ariaFirstPageMessage: 'go to first page',   ariaPreviousPageMessage: 'go to previous page',   ariaPageNMessage: 'page',   ariaNextPageMessage: 'go to next page',   ariaLastPageMessage: 'go to last page',   ariaRowCheckboxMessage: 'Select row',   ariaHeaderCheckboxMessage: 'Select all rows',   ariaGroupHeaderCheckboxMessage: 'Select row group',   ariaLoadingMessage: 'Loading' }` | Message overrides for localization |
| offset | `number` |  | The current offset ( page - 1 ) shown. Default value: `0` |
| reorderable | `boolean` |  | Enable/Disable ability to re-order columns by dragging them. |
| rowClass | `((row: TRow) => string \| Record<string, boolean>) \| undefined` |  | A function which is called with the row and should return either:<br><br>• a string: `"class-1 class-2`<br><br>• a Record\<string, boolean\>: `{ 'class-1': true, 'class-2': false }` |
| rowDraggable | `boolean` |  | A flag to enable drag behavior of native HTML5 drag and drop API on rows. If set to true, [rowDragEvents](<index.html#DatatableComponent.rowDragEvents>) will emit dragstart and dragend events. |
| rowHeight | `number \| "auto" \| ((row: TRow) => number)` |  | Height of each row. When virtual scrolling is disabled, use `'auto'` for fluid heights. With virtual scrolling enabled, provide a number or a function that calculates each row's height. |
| rowIdentity | `(x: RowOrGroup<TRow>) => unknown` |  | This will be used when displaying or selecting rows. when tracking/comparing them, we'll use the value of this fn,<br><br>(`fn(x) === fn(y)` instead of `x === y`) |
| rows | `(TRow \| undefined)[] \| null \| undefined` |  | Rows that are displayed in the table. |
| scrollbarH | `boolean` |  | Enable horz scrollbars |
| scrollbarV | `boolean` |  | Enable vertical scrollbars |
| scrollbarVDynamic | `boolean` |  | Enable vertical scrollbars dynamically on demand. Property `scrollbarV` needs to be set `true` too. Width that is gained when no scrollbar is needed is added to the inner table width. |
| selectAllRowsOnPage | `boolean` |  | Property to which you can use for determining select all rows on current page or not. |
| selectCheck | `((value: TRow, index: number, array: TRow[]) => boolean) \| undefined` |  | A boolean/function you can use to check whether you want to select a particular row based on a criteria. Example:<br><br>(selection) =\> { return selection !== 'Ethel Price'; } |
| selected | `TRow[]` |  | List of row objects that should be represented as selected in the grid. Default value: `[]` |
| selectionType | `SelectionType \| undefined` |  | Type of row selection. Options are:<br><br>• `single`<br><br>• `multi`<br><br>• `checkbox`<br><br>• `multiClick`<br><br>• `cell`<br><br>For no selection pass a `falsey`. Default value: `undefined` |
| sorts | `SortPropDir[]` |  | Array of sorted columns by property and type. Default value: `[]` |
| sortType | `SortType` |  | Sorting mode. In `single` mode, sorting a new column replaces existing sorts; in `multi` mode, it adds an additional column sort. |
| summaryHeight | `number` |  | A height of summary row |
| summaryPosition | `string` |  | A property holds a summary row position: top/bottom |
| summaryRow | `boolean` |  | A flag for switching summary row on / off |
| swapColumns | `boolean` |  | Swap columns on re-order columns or move them. |
| targetMarkerTemplate | `TemplateRef<unknown> \| undefined` |  | Template for the target marker of drag target columns. |
| trackByProp | `keyof TRow \| undefined` |  | Property to which you can use for custom tracking of rows. Example: 'name' |
| treeFromRelation | `string \| undefined` |  | Tree from relation |
| treeToRelation | `string \| undefined` |  | Tree to relation |
| virtualization | `boolean` |  | A flag for row virtualization on / off |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| activate | `ActivateEvent<TRow>` | A cell or row was focused via keyboard or mouse click. |
| offsetChange | `number` | The current offset ( page - 1 ) shown. Default value: `0` |
| page | `PageEvent` | The table was paged either triggered by the pager or the body scroll. |
| reorder | `ReorderEvent` | Columns were re-ordered. |
| resize | `ColumnResizeEvent` | Column was resized. |
| rowDragEvents | `DragEventData` | Emits HTML5 native drag events. Only emits dragenter, dragover, drop events by default. Set [rowDraggable](<index.html#DatatableComponent.rowDraggable>) to true for dragstart and dragend. |
| scroll | `ScrollEvent` | Body was scrolled typically in a `scrollbarV:true` scenario. |
| selectedChange | `TRow[]` | List of row objects that should be represented as selected in the grid. Default value: `[]` |
| sortsChange | `SortPropDir[]` | Array of sorted columns by property and type. Default value: `[]` |
| tableContextmenu | `ContextMenuEvent<TRow>` | The context menu was invoked on the table. type indicates whether the header or the body was clicked. content contains either the column or the row that was clicked. |
| treeAction | `{ row: TRow; rowIndex: number; }` | A row was expanded ot collapsed for tree |

#### Methods

#### Methods

##### recalculate

**Modifiers:** deprecated

Deprecated: No-op. Dimensions are kept current by a `ResizeObserver` on the host element; this will be removed in a future release.

```
recalculate(): void
```

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

### [SiDatatableInteractionDirective](<https://github.com/siemens/element/blob/main/projects/element-ng/datatable/si-datatable-interaction.directive.ts#L36-L151>)

**Kind:** directive

**Selector:** `ngx-datatable[siDatatableInteraction]`

**Exported as:** `si-datatable-interaction`

```
import { SiDatatableInteractionDirective } from '@siemens/element-ng/datatable';
```

```
directive SiDatatableInteractionDirective implements OnDestroy, OnInit
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [datatableInteractionAutoSelect](<https://github.com/siemens/element/blob/main/projects/element-ng/datatable/si-datatable-interaction.directive.ts#L44-L44>) | `boolean` | `false` | Automatically select every row or cell that is navigated trough. Is ignored unless `selectionType` is `single` or `cell`. |
