AdaptTable for Unstyled

Aggregation in Unstyled

aggregate() computes the table footer and each team's groupAggregates; groupFooters closes each team with its subtotal.

Search the table and group totals and the footer recompute from matching rows. The host-owned portfolio total uses pinnedSummaryRows and remains above the scrolling body, independent of filtering and sorting.

All three surfaces render through the same Unstyled controls on desktop and in phone cards.

The code

import { Component, computed, input } from "@angular/core";
import { aggregate, type ColumnDef } from "@adapttable/angular";
import { AdaptDataTable } from "@adapttable/angular-unstyled";
import { groupingPanel } from "@adapttable/angular-unstyled/grouping-panel";
import { pinnedSummaryRows } from "@adapttable/angular-unstyled/pinned-summary-rows";

@Component({
  selector: "app-totals",
  imports: [AdaptDataTable],
  template: `
    <adapt-data-table
      [data]="rows()" [columns]="columns" [rowKey]="rowKey"
      [summaryRow]="budgetSum" [features]="features()"
    />
  `,
})
export class Totals {
  readonly rows = input.required<readonly Person[]>();
  readonly totals = input.required<readonly Person[]>();
  readonly columns: ColumnDef<Person>[] = [
    { key: "name" }, { key: "team" }, { key: "budget" },
  ];
  readonly rowKey = (row: Person) => row.id;
  readonly budgetSum = aggregate<Person>({ budget: "sum" });
  readonly features = computed(() => [
    groupingPanel<Person>("team", {
      groupAggregates: this.budgetSum, groupFooters: true,
    }),
    pinnedSummaryRows<Person>({ top: this.totals() }),
  ]);
}

Install

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

The same feature in the other kits

More Unstyled features

Reference: row-grouping, pinned-summary-rows, full-width-rows. More of this kit: AdaptTable for Unstyled, or the live demo.