Skip to content

BaseDataTable โ€‹

BaseDataTable is the core orchestrator table shell built on Vuetify v-data-table. Use it in plugin and workbench list widgets for a consistent toolbar, filters, export/import hooks, and row-action layout.

vue
import BaseDataTable from "@raclettejs/core/orchestrator/components/dataTable/BaseDataTable.vue"

Separation of concerns

Core (BaseDataTable) provides table chrome: toolbar, filter drawer, export/import wiring, row selection, delete-confirm plumbing.

Your widget owns data fetching ($data), CRUD, routing, deleted-items toggles, and restore actions. Do not put workbench-specific routing into core.


Quick start โ€‹

vue
<template>
  <BaseDataTable
    :items="rows"
    :headers="headers"
    :data-name="$t('myPlugin.list.dataName')"
    :show-filters="true"
    :row-click-handler="(item) => goToEditById('myEditLink', item._id)"
  >
    <template #toolbar-end>
      <v-btn
        prepend-icon="mdi-plus"
        variant="flat"
        color="success"
        :text="$t('core.baseDataTable.createDataButton', { dataName: $t('myPlugin.list.dataName') })"
        @click="goToCreate('myCreateLink')"
      />
    </template>

    <template #row-actions="{ item }">
      <BaseDataTableConfirmDeleteBtn :item="item" @delete="deleteRow(item)" />
    </template>
  </BaseDataTable>
</template>

For Workbench plugins, keep navigation in useWorkbenchTableActions (workbench app composable) rather than encoding it in BaseDataTable.


Props โ€‹

Data and display โ€‹

PropTypeDefaultDescription
itemsT[][]Rows shown in the table
loadingbooleanโ€”Loading state
headersArray<{ title, key, โ€ฆ }>requiredColumn definitions
dataNamestringrequiredEntity label (search placeholder, toolbar title)
itemValuestring"_id"Unique row key for selection and export
itemsPerPagenumber10Pagination page size
sortBy{ key, order }[]โ€”Initial column sort
groupBystring | string[]โ€”Vuetify group-by key(s)
showSearchbooleantrueSearch field above the table
showLoadingbooleantruePass loading through to v-data-table
showActionsColumnbooleantrueAppend an actions column
actionsHeaderTitlestringโ€”Overrides core.baseDataTable.actions

Row interaction โ€‹

PropTypeDescription
rowClickHandler(item, context?) => voidCalled on row click (skips interactive controls)
isRowClickable(item) => booleanWhen set with rowClickHandler, limits pointer cursor and clicks

Deleted / soft-delete behaviour โ€‹

PropTypeDescription
itemsDeletedbooleanTints rows and switches hard-delete confirm copy
confirmDeletebooleanShow confirm dialog for requestDelete (default true)
getDeleteConfirmMessage(item) => stringSoft-delete message
getHardDeleteConfirmMessage(item) => stringUsed when itemsDeleted is true

Filters โ€‹

PropTypeDefaultDescription
showFiltersbooleanfalseShow Filters button and drawer
filterMaxSelectOptionsnumber300Max distinct values before a column uses a text field
filterDrawerAttach"auto" | "viewport" | "parent""auto"Drawer attachment; see Filters
onFilterStateChange(filters, context) => voidโ€”Draft filter edits in the drawer
onFilterApply(filters, context) => voidโ€”After Apply
onFilterReset(filters, context) => voidโ€”After Reset

Export and import โ€‹

See also DataExporter.

PropTypeDefaultDescription
showExportbooleantrueExport mode in the actions menu
showSelectbooleanfalseCheckbox column independent of export
exportableItemsRecord[]โ€”Canonical records for export (matched by itemValue)
exportMetaobjectโ€”Optional meta in export payload
exportRowShape"visible-columns" | "full-records""visible-columns"Project export to header keys or full rows
exportShowDataScopeSwitchbooleantrueItems/meta/combined toggle in exporter
exportFormatsFormatEntry[]["json"]Export formats
exportDefaultFormatstring"json"Default format
onFileLoaded(content, file) => voidโ€”Enables import in the actions menu
importAcceptstring".json"File input accept
importReadAs"text" | "arrayBuffer""text"File read mode

Toolbar indicators โ€‹

PropTypeDefaultDescription
toolbarIndicators{ id, label, color?, icon? }[][]Generic active-mode chips and โ‹ฎ menu badge

Core does not know what each indicator means โ€” widgets pass labels and colours. Example for deleted-items mode:

vue
:toolbar-indicators="
  showDeleted
    ? [{ id: 'deleted', label: $t('core.showDeleted'), color: 'error', icon: 'mdi-delete-outline' }]
    : []
"

When any indicator is present:

  • A dot (or count) badge appears on the โ‹ฎ actions menu button
  • Default chips render in the toolbar (override with #toolbar-indicators)

Slots โ€‹

Toolbar โ€‹

SlotPurpose
toolbar-startLeft side (default: dataName title)
toolbar-leadingControls before actions (e.g. DB selector)
toolbar-indicatorsOverride default mode chips; props: { indicators }
toolbar-endPrimary actions (e.g. Create)
toolbar-filters-triggerOverride Filters button; props: { openFilters, toggleFilterDrawer, isFilterDrawerOpen }
toolbar-actions-triggerOverride โ‹ฎ menu activator; props: { isOpen, toggle }
toolbar-actions-menuExtra entries in the โ‹ฎ menu (e.g. show-deleted switch)
toolbar-searchOverride search field

Row actions โ€‹

SlotPurpose
prepend-row-actionsIcons before row actions (e.g. restore)
row-actionsPer-row actions (delete, edit, โ€ฆ)
append-row-actionsTrailing row actions

Filters drawer โ€‹

SlotPurpose
filters.summaryAbove drawer header; props: { filters, activeCount }
filters.drawer.headerDrawer title row
filters.drawer.bodyFilter fields
filters.drawer.footerApply / Reset buttons

Export / import โ€‹

SlotPurpose
exporterReplace DataExporter
importerReplace import UI
action.export-modeCustom export-mode menu item
action.importCustom import menu item

Columns and passthrough โ€‹

SlotPurpose
item.<key>Custom cell renderer for a column
body.prepend, body.append, tfootSummary rows
bottom, thead, โ€ฆOther v-data-table slots forwarded automatically
dialogsSibling content below the table

Built-in column slots: item.color, item.tags (when not overridden).


Patterns โ€‹

Delete with confirmation โ€‹

Use BaseDataTableConfirmDeleteBtn inside #row-actions. It calls requestDelete from useBaseDataTableDeleteConfirm() (provided by BaseDataTable).

vue
<template #row-actions="{ item }">
  <BaseDataTableConfirmDeleteBtn :item="item" @delete="deleteRow(item)" />
</template>

Show deleted / hard delete โ€‹

Keep showDeleted in the widget. Wire:

  • :items-deleted="showDeleted" โ€” row tint and hard-delete messages
  • #toolbar-actions-menu โ€” switch to toggle the mode
  • :toolbar-indicators โ€” visible badge/chip when the mode is active (even with zero rows)
  • #prepend-row-actions โ€” restore icon when showDeleted

Fetch with isDeleted: showDeleted.value on your $data calls.

Export round-trip (Workbench) โ€‹

See DataExporter โ€” Use with BaseDataTable.


Filters โ€‹

  • Click Filters to open a right-side drawer.
  • Edits are draft until Apply; Reset clears applied filters.
  • Columns with active filters get a highlighted header and cell background.

Drawer attachment โ€‹

filterDrawerAttachBehaviour
auto (default)Viewport v-navigation-drawer on page and inline; custom slide-over panel inside the table host when slotType is modal
viewportFull-height drawer on the viewport
parentDrawer contained to the table host element

Modal detection uses provide / inject from WidgetsLayoutLoader (slotType: page | modal | inline) โ€” the same value every *Widget.vue receives. No extra widget prop is required.

On full-page tables with the raclette footer (โ€œCooked with racletteโ€), the drawer footer gets extra bottom padding so Apply/Reset stay above the app footer.


See also โ€‹