π DataExporter - Exporting items, meta, or both β
Use DataExporter when users need to export data from your widget or table.
Quick start β
<template>
<DataExporter
:data="exportPayload"
:formats="['json', 'yaml']
filename="servers"
default-format="json"
/>
</template>
<script setup lang="ts">
import DataExporter from "@raclettejs/core/orchestrator/components/dataExport/DataExporter.vue"
const exportPayload = {
items: [
{ id: "1", name: "vm-1" },
{ id: "2", name: "vm-2" },
],
meta: {
generatedAt: new Date().toISOString(),
currency: "EUR",
},
}
</script>Canonical payload shape β
DataExporter expects this envelope:
{
items: unknown[]
meta?: unknown
}Data scope switch β
The exporter popover provides a data scope switch:
Combined-> exports{ items, meta? }Items-> exports only theitemsarrayMeta-> exports only themetaobject
This is useful when users want:
- just invoice line items (
items) - just configuration object (
meta) - full context (
combined)
Use with BaseDataTable β
BaseDataTable already wires DataExporter and emits the export envelope.
<BaseDataTable
:items="rows"
:exportable-items="rows"
item-value="id"
:show-filters="true"
:export-formats="['json', myCustomFormat]"
/>New table action model β
- Export selection checkboxes are shown only when export mode is enabled from the table actions menu.
- Import and filter controls are available from the actions menu.
- Active per-column filters are indicated in the header (
*suffix on the affected column title). - Create/Edit/Delete are intentionally not built in; implement those in consumer widgets via slots and
rowClickHandler.
Workbench action-layer pattern β
For Workbench plugins, keep routing/CUD behavior in a shared Workbench composable (for example useWorkbenchTableActions) instead of encoding it in BaseDataTable.
Typical usage:
<BaseDataTable
:items="rows"
:headers="headers"
:row-click-handler="(item) => goToEditById('myEditLink', item._id)"
>
<template #toolbar-end>
<v-btn @click="goToCreate('myCreateLink')">Create</v-btn>
</template>
<template #row-actions="{ item }">
<v-btn icon="mdi-delete" @click.stop.prevent="deleteRow(item)" />
</template>
</BaseDataTable>Important β
- Always set
item-valueto a real unique key in your row model (id,_id, ...). - If
item-valueis wrong, selected rows can map incorrectly. - Use
export-metawhen your serializers need contextual fields. - Exported row fields are automatically projected to the keys present in
headers. - Columns not present in
headersare not included in exported row objects. - The internal/system
actionscolumn is never exported.
Relevant BaseDataTable slots β
exporter: replace or fully customise exporter rendering.importer: replace/augment import trigger rendering.action.export-mode: customise export-mode action entry.action.filters: customise filter action entry.action.import: customise import action entry.filters.drawer.header|body|footer: customise right-side filter drawer sections.
Built-in formats β
Built-ins serialize the selected scope payload as-is:
jsonyamlxml
So if users select Items, built-ins serialize just the array.
Troubleshooting β
Serializer says payload is invalid β
Your custom format likely validates only one shape. Make it support all relevant scope outputs (combined, items, optionally meta) or normalize input before rendering.
Export button disabled β
In BaseDataTable, export is disabled when no rows are selected.