AdaptTable for Nuxt UI

Aggregation in Nuxt UI

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 Nuxt UI controls on desktop and in phone cards.

The code

<script setup lang="ts">
import { computed } from "vue";
import { aggregate, type ColumnDef } from "@adapttable/vue";
import { DataTable } from "@adapttable/nuxt-ui";
import { groupingPanel } from "@adapttable/nuxt-ui/grouping-panel";
import { pinnedSummaryRows } from "@adapttable/nuxt-ui/pinned-summary-rows";

const props = defineProps<{
  rows: readonly Person[];
  totals: readonly Person[];
}>();

const columns: ColumnDef<Person>[] = [
  { key: "name" }, { key: "team" }, { key: "budget" },
];
const rowKey = (row: Person) => row.id;
const budgetSum = aggregate<Person>({ budget: "sum" });
const features = computed(() => [
  groupingPanel<Person>("team", {
    groupAggregates: budgetSum, groupFooters: true,
  }),
  pinnedSummaryRows<Person>({ top: props.totals }),
]);
</script>

<template>
  <DataTable
    :data="rows" :columns="columns" :row-key="rowKey"
    :summary-row="budgetSum" :features="features"
  />
</template>

Install

pnpm add @adapttable/nuxt-ui @adapttable/vue @adapttable/core @nuxt/ui

The same feature in the other kits

More Nuxt UI features

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