AdaptTable for Angular CDK

Rows in Angular CDK

A row is more than a record. Pin it to the top or the bottom from its 3-dot menu, and merge a team that runs down consecutive rows so the name is written once.

rowPinning(), cellSpan() and a "menu" row-actions layout are what this page turns on. The table holds the pinned rows and keeps them in the URL, so a reload or a shared link keeps them where they were; pass pinnedRowIds to hold them yourself.

Grouping and trees refuse pinning: a nested list is not a flat pin stack. The pin keeps a team merge together — the person moves, the team stays one cell.

The code

import { Component, input } from "@angular/core";
import type { ColumnDef } from "@adapttable/angular";
import { AdaptDataTable } from "@adapttable/angular-cdk";
import { cellSpan } from "@adapttable/angular-cdk/cell-span";
import { rowActions } from "@adapttable/angular-cdk/row-actions";
import { rowPinning } from "@adapttable/angular-cdk/row-pinning";

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

function spanTeam({
  column,
  sectionRows,
  sectionRowIndex,
}: {
  column: { key: string };
  sectionRows: readonly Person[];
  sectionRowIndex: number;
}) {
  if (column.key !== "team") return undefined;
  const team = sectionRows[sectionRowIndex]?.team;
  if (sectionRows[sectionRowIndex - 1]?.team === team) return undefined;
  let rowSpan = 1;
  while (sectionRows[sectionRowIndex + rowSpan]?.team === team) rowSpan += 1;
  return rowSpan > 1 ? { rowSpan } : undefined;
}

@Component({
  selector: "app-people",
  imports: [AdaptDataTable],
  template: `
    <adapt-data-table
      [data]="rows()"
      [columns]="columns"
      [rowKey]="rowKey"
      [features]="features"
    />
  `,
})
export class People {
  readonly rows = input.required<readonly Person[]>();
  readonly columns = columns;
  readonly rowKey = (row: Person) => row.id;
  readonly features = [
    rowPinning(),
    cellSpan(spanTeam),
    rowActions<Person>([], { layout: "menu" }),
  ];
}

Install

# Follow the kit setup guide for compatible peers
pnpm add @adapttable/angular-cdk @adapttable/angular @angular/cdk@22.2.1 @angular/forms@^22 rxjs@^7.8.2

The same feature in the other kits

More Angular CDK features

Reference: row-pinning, row-reordering, row-spanning. More of this kit: AdaptTable for Angular CDK, or the live demo.