GRID FEATURE
Copy cells
Copy one cell's display text to the system clipboard. Selected text inside a cell editor and a focused Grid cell are different copy targets.
How it works and when to use it
Clipboard access depends on the browser environment and user activation. Request copying from a button click or keyboard action and check the return value.
In the code, grid is the Grid element prepared in the installation chapter. Check each example's data and settings, and implement the app functions and server endpoints for your project.
Example 1. Copy the first displayed product
Connect the following call to the user's Copy button click.
const copied = await grid.copyCellAt(0, 'product');
console.log(copied);Verify the result: true indicates successful copying. If the table has been sorted, the target is the product in the current first displayed row.
Example 2. Copy calculated or formatted cells
Apply currency formatting to an amount, then inspect the copied text. Do not assume the copied value equals the original number.
Verify the result: Paste into the target input to verify the intended representation. For machine-readable numbers, reading the source data API may be more appropriate.
Example 3. Permissions and failure handling
Try copying both restricted and regular cells, and display appropriate guidance for rejected operations.
grid.clipboardEscapeFormulae = true;Verify the result: Also review protection settings for strings that spreadsheet apps may interpret as formulas. Distinguish this protection from changing the meaning of business values.
Combining features and troubleshooting
Browsers may reject clipboard requests from asynchronous timers unrelated to user activation. Do not report clipboard permission failures as Grid data errors.
If source values are restricted, tooltips, copying, and export must follow the same access policy. Merely removing visible text is insufficient.
Related reading
- How rows, columns, and IDs relate
- Connect results and events
- Explore in Features
The guide describes which interactions are available to try.