AdaptTable for ng-bootstrap

Aggregation in ng-bootstrap

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 ng-bootstrap 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/ng-bootstrap";
import { groupingPanel } from "@adapttable/ng-bootstrap/grouping-panel";
import { pinnedSummaryRows } from "@adapttable/ng-bootstrap/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

# Follow the kit setup guide for compatible peers
pnpm add @adapttable/ng-bootstrap @adapttable/angular @ng-bootstrap/ng-bootstrap@21.0.0 @popperjs/core@2.11.8 @angular/forms@^22 @angular/localize@^22 rxjs@^7.4.0

The same feature in the other kits

More ng-bootstrap features

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