useGridSelection
Composable for programmatic selection control.
Must be used within a component that contains a TbwGrid with the selection feature enabled. Uses Vue’s provide/inject, so it works reliably regardless of when the grid renders.
useGridSelection(selector: string): SelectionMethods<TRow>Parameters
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 { useGridSelection } from '@toolbox-web/grid-vue/features/selection';
const { selectAll, clearSelection, getSelection } = useGridSelection();
function exportSelected() { const selection = getSelection(); if (!selection) return; // Derive rows from selection.ranges and grid.rows}</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