useGridExport
Composable for programmatic export control.
Must be used within a component that contains a TbwGrid with the export feature enabled.
useGridExport(selector: string): ExportMethodsParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
selector | string | Optional CSS selector to target a specific grid element via |
| DOM query instead of using Vue’s provide/inject. Use when the component | ||
contains multiple grids, e.g. 'tbw-grid.primary' or '#my-grid'. |
Example
Section titled “Example”<script setup>import { useGridExport } from '@toolbox-web/grid-vue/features/export';
const { exportToCsv, exportToExcel, isExporting } = useGridExport();
async function handleExport(format: 'csv' | 'excel' | 'json') { if (isExporting()) return; // Prevent concurrent exports
switch (format) { case 'csv': exportToCsv('data.csv'); break; case 'excel': exportToExcel('data.xlsx'); break; case 'json': exportToJson('data.json'); break; }}</script>
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt