AdaptTable for Vuetify

Nested tables in Vuetify

Open a row and the panel holds another Vuetify table — the same component, not a hand-built list. Each person has recent orders; the inner table has its own columns and row keys.

nestedTable() mounts the kit's DataTable with defaults that keep the two tables from fighting over the URL. Rows with no nested table can still use rowDetail().

The expand chevron and both tables are Vuetify.

The code

<script setup lang="ts">
import { h } from "vue";
import type { ColumnDef } from "@adapttable/vue";
import { DataTable } from "@adapttable/vuetify";
import { nestedTable } from "@adapttable/vuetify/nested-table";

interface Order {
  id: string;
  item: string;
}

interface Customer {
  id: string;
  name: string;
  orders: Order[];
}

defineProps<{ rows: readonly Customer[] }>();

const columns: ColumnDef<Customer>[] = [{ key: "name" }];
const orderColumns: ColumnDef<Order>[] = [{ key: "item" }];
const rowKey = (row: Customer) => row.id;
const features = [
  nestedTable<Customer>((row) => ({
    label: `Orders for ${row.name}`,
    table: (defaults) =>
      h(DataTable<Order>, {
        ...defaults,
        data: row.orders,
        columns: orderColumns,
        rowKey: (order: Order) => order.id,
      }),
  })),
];
</script>

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

Install

pnpm add @adapttable/vuetify @adapttable/vue @adapttable/core vuetify

The same feature in the other kits

More Vuetify features

Reference: tree-data, row-expansion. More of this kit: AdaptTable for Vuetify, or the live demo.