AdaptTable for NG-ZORRO

Row and column virtualization in NG-ZORRO

Compose virtualize() and the table renders the rows in view plus a small overscan, whatever the dataset's size — forty thousand rows on this page, a few dozen of them in the page at once.

The scroll box scrolls rather than the page, and sorting and filtering keep working on the whole dataset rather than on what is drawn. virtualize({ virtualizeColumns: true }) does the same across, for column sets wider than the box.

The code

import { Component, input } from "@angular/core";
import type { ColumnDef } from "@adapttable/angular";
import { AdaptDataTable } from "@adapttable/ng-zorro";
import { virtualize } from "@adapttable/ng-zorro/virtualize";

const columns: ColumnDef<Person>[] = [
  { key: "name", sortable: true },
  { key: "team" },
  { key: "budget", sortable: true },
];

@Component({
  selector: "app-people",
  imports: [AdaptDataTable],
  template: `
    <adapt-data-table
      [data]="rows()"
      [columns]="columns"
      [rowKey]="rowKey"
      paginationMode="infinite"
      [maxHeight]="480"
      [features]="features"
    />
  `,
})
export class People {
  readonly rows = input.required<readonly Person[]>();
  readonly columns = columns;
  readonly rowKey = (row: Person) => row.id;
  readonly features = [virtualize()];
}

Install

pnpm add @adapttable/ng-zorro @adapttable/angular @adapttable/core ng-zorro-antd @angular/forms @angular/router

The same feature in the other kits

More NG-ZORRO features

Reference: virtualization. More of this kit: AdaptTable for NG-ZORRO, or the live demo.