Export & Clipboard
Clipboard
Use LyteNyte Grid's clipboard API methods to implement copy, cut, and paste with customizable transform options.
LyteNyte Grid does not provide a direct API for clipboard operations, but it offers methods you can combine to implement copy, cut, and paste. Pair these methods with cell selection to support familiar spreadsheet-style interactions.
- Use
api.exportDataRectto retrieve data for the full grid or a selected section. - Use
api.editUpdateto modify cell values.
Clipboard Operation Flow
The basic approach for clipboard support is:
- Copy - Call
api.exportDataRectto get the selected data, then write it to the clipboard. - Cut - Call
api.exportDataRectto get the selected data, write it to the clipboard, then callapi.editUpdateto clear those cells.
Note:api.editUpdaterequires the cells to be editable. See the cell editing guide for details. - Paste - Read and parse the clipboard content, then call
api.editUpdateto update the target cells.
As an alternative to exportDataRect, call exportCsv to get a string that can be written directly
to the clipboard.
Example
The following example demonstrates copy, cut, and paste in a simple grid setup.