AdaptTable for Vue Unstyled

Live updates in Vue Unstyled

Rows patch in as they arrive, the way a websocket would. This page applies one budget change at a time so the movement is followable.

Patches go through the row-patch API rather than replacing the array, so search, filters and sort re-run for the touched rows only — your scroll and selection survive.

The feed lists every patch as it lands. The table is Vue Unstyled.

The code

<script setup lang="ts">
import { applyRowPatches, updateRow } from "@adapttable/core";
import { shallowRef } from "vue";
import type { ColumnDef } from "@adapttable/vue";
import { DataTable } from "@adapttable/vue-unstyled";

defineProps<{ columns: readonly ColumnDef<Person>[] }>();

const rows = shallowRef<readonly Person[]>([]);
const rowKey = (row: Person) => row.id;

function patchBudget(id: string, budget: number) {
  rows.value = applyRowPatches(
    rows.value, [updateRow<Person>(id, { budget })], rowKey,
  );
}
defineExpose({ patchBudget });
</script>

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

Install

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

The same feature in the other kits

More Vue Unstyled features

Reference: realtime, cell-editing. More of this kit: AdaptTable for Vue Unstyled, or the live demo.