AdaptTable for Quasar

AI table assistant in Quasar Vue

This demo mounts a real Quasar Vue table and its Quasar assistant. Start with scripted sorting, questions and approved edits, or connect your HTTP backend for free-form AI requests. The scripted mode needs no model or API key.

A question filters the table only after you answer. A proposed edit waits for your approval in the assistant, the table or a dialog; an approved write updates the host's data and its status line. Rejecting leaves the data unchanged, and the conversation records the execution result.

tableAgent and useTableAssistant from @adapttable/ai-vue share the mounted table's session. The snippet below shows a minimal local sorting transport; the demo also includes questions and governed edits. JSON, OpenAI, HTTP, MCP, MCP Apps, WebMCP, AG-UI and AI SDK helpers can use the same session in your application.

The code

<script setup lang="ts">
import type { AgentSession, AssistantTransport } from "@adapttable/ai";
import { tableAgent, useTableAssistant } from "@adapttable/ai-vue";
import { shallowRef } from "vue";
import type { ColumnDef } from "@adapttable/vue";
import { DataTable } from "@adapttable/quasar";
import { TableAssistant } from "@adapttable/quasar/assistant";

interface AgentPerson { id: string; name: string; salary: number }

// A minimal local transport: no model, endpoint or API key.
const transport: AssistantTransport = {
  send: async ({ session, text, signal }) => {
    if (!text.toLowerCase().includes("sort")) {
      return { text: "Try: sort salaries highest first." };
    }
    const key = "view.setSort";
    const result = await session.execute(
      key,
      { key: "salary", dir: "desc" },
      session.manifest().viewRevision,
      crypto.randomUUID(),
      signal
    );
    return {
      text: result.ok ? "Highest salary first." : "The sort was not applied.",
      keys: [key],
      results: [result],
    };
  },
};

const rows: readonly AgentPerson[] = [
  { id: "ada", name: "Ada Lovelace", salary: 120 },
  { id: "grace", name: "Grace Hopper", salary: 140 },
];
const columns: readonly ColumnDef<AgentPerson>[] = [
  { key: "name", header: "Person" },
  { key: "salary", header: "Salary", sortable: true },
];
const rowKey = (row: AgentPerson) => row.id;
const session = shallowRef<AgentSession>();
const open = shallowRef(false);
const assistant = useTableAssistant(() => ({
  session: session.value,
  transport,
  open: open.value,
  onOpenChange: (value) => {
    open.value = value;
  },
}));
const features = [tableAgent({
  tableId: "people", approval: "never",
  columns: { salary: { type: "number", sortable: true } },
  bridge: { attach: (value) => { session.value = value; } },
})];
</script>

<template>
  <DataTable
    :data="rows" :columns="columns" :row-key="rowKey"
    :features="features" :url-sync="false"
  />
  <TableAssistant
    :assistant="assistant.view.value"
    :open="assistant.open.value"
    :on-open-change="assistant.setOpen"
    presentation="floating"
  />
</template>

Install

pnpm add @adapttable/quasar @adapttable/vue @adapttable/core quasar@2.34.0

The same feature in the other kits

More Quasar features

Reference: ai-http, ai-integrations, ai, agent-capabilities. More of this kit: AdaptTable for Quasar, or the live demo.