AdaptTable for Spartan

Live updates in Spartan

Rows patch in as they arrive, the way a websocket would. This page applies one budget change at a time so the movement is followable.

Patches go through the row-patch API rather than replacing the array, so search, filters and sort re-run for the touched rows only — your scroll and selection survive.

The feed lists every patch as it lands. The table is Spartan.

The code

import { Component, input, signal } from "@angular/core";
import type { ColumnDef } from "@adapttable/angular";
import { applyRowPatches, updateRow } from "@adapttable/core";
import { AdaptDataTable } from "@adapttable/spartan";

@Component({
  selector: "app-live-people",
  imports: [AdaptDataTable],
  template: `
    <adapt-data-table
      [data]="rows()" [columns]="columns()" [rowKey]="rowKey"
    />
  `,
})
export class LivePeople {
  readonly rows = signal<readonly Person[]>([]);
  readonly columns = input.required<readonly ColumnDef<Person>[]>();
  readonly rowKey = (row: Person) => row.id;

  patchBudget(id: string, budget: number): void {
    this.rows.update((rows) => applyRowPatches(
      rows, [updateRow<Person>(id, { budget })], this.rowKey,
    ));
  }
}

Install

# Follow the kit setup guide for compatible peers
pnpm add @adapttable/spartan @adapttable/angular @spartan-ng/brain@1.5.0 @angular/cdk@^22 @angular/forms@^22 rxjs@^7.8.0 tailwindcss@^4 clsx@^2.1.1 tw-animate-css@^1

The same feature in the other kits

More Spartan features

Reference: realtime, cell-editing. More of this kit: AdaptTable for Spartan, or the live demo.