AdaptTable for Unstyled

Saved views in Unstyled

A view is the table's state — search, sort, filters and the column layout — saved under a name.

Save one from the views menu and pick it again later to put the table back the way it was. The list lives in this browser's storage, or in any store you hand savedViews.

The code

import { Component, input } from "@angular/core";
import type { ColumnDef } from "@adapttable/angular";
import { AdaptDataTable } from "@adapttable/angular-unstyled";
import { filters } from "@adapttable/angular-unstyled/filters";
import { savedViews } from "@adapttable/angular-unstyled/saved-views";

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"
      urlKey="people"
      [features]="features"
    />
  `,
})
export class People {
  readonly rows = input.required<readonly Person[]>();
  readonly columns = columns;
  readonly rowKey = (row: Person) => row.id;
  readonly features = [
    filters([]),
    savedViews({ storageKey: "people-views", urlKey: "people" }),
  ];
}

Install

pnpm add @adapttable/angular-unstyled @adapttable/angular @adapttable/core

The same feature in the other kits

More Unstyled features

Reference: saved-views, url-state. More of this kit: AdaptTable for Unstyled, or the live demo.