ClipboardSelection

@Immutable
data class ClipboardSelection<T>(val rows: List<T>, val columns: List<DataTableHeader<T>>, val cells: List<List<String>>)(source)

What a copy covers: the rows, the columns, and the text of every cell where they cross.

Handed to DataTable's onCopy. Both rows and columns are in display order, so a caller writing CSV, XLSX, or anything else gets the grid exactly as the user sees it — sorted, paged, and with hidden columns already gone.

Supplying onCopy replaces the table's own clipboard write rather than running alongside it, so a handler that only logs or displays the selection leaves the clipboard untouched. Call copyToSystemClipboard from inside it to do both.

Constructors

Link copied to clipboard
constructor(rows: List<T>, columns: List<DataTableHeader<T>>, cells: List<List<String>>)

Properties

Link copied to clipboard

Cell text, row-major: cells[row][column] lines up with rows and columns. Text is what the cell shows — each column's value put through its format — so a copy carries the same money symbols and dates the user was looking at. A column that renders only through cellContent copies as empty; give it a value and it becomes sortable and copyable at once. The raw values are still within reach for a handler that wants them: columns carries every column's own value extractor, and rows the items to run it against.

Link copied to clipboard

The selected leaf columns, in display order.

Link copied to clipboard
val rows: List<T>

The selected row items, in display order.

Functions

Link copied to clipboard

Puts this selection on the system clipboard as tab-separated text, reporting whether it got there.

Link copied to clipboard
fun toTabSeparated(includeHeader: Boolean = false): String

Renders the selection as tab-separated text, which is what spreadsheets paste natively.