View as Markdown

API reference: @salmonui/data-grid

DataGridBeforeCopyEventinterface

import type { DataGridBeforeCopyEvent } from '@salmonui/data-grid';
interface DataGridBeforeCopyEvent extends DataGridEvent {
    data: string;
    readonly includeHeaders: boolean;
    readonly copied: 'range' | 'rows' | 'cell';
    readonly cells: number;
    readonly rowIds: readonly RowId[];
    readonly fields: readonly string[];
}

onBeforeCopy: preventDefault() cancels, assigning data replaces the text.

DataGridBeforeCopyEvent members (10, 4 inherited)
NameSignatureDescription
datadata: string;

The TSV text about to be written to the clipboard. Assign to replace it.

includeHeadersreadonly includeHeaders: boolean;
copiedreadonly copied: 'range' | 'rows' | 'cell';

What was copied: the cell range, the selected rows, or the focused cell.

cellsreadonly cells: number;

Copied data cells (headers excluded).

rowIdsreadonly rowIds: readonly RowId[];
fieldsreadonly fields: readonly string[];
typeinheritedtype: string;

'sortChange', 'beforeSortChange', ...

sourceinheritedsource: DataGridEventSource;
defaultPreventedinheriteddefaultPrevented: boolean;

True after preventDefault() (before-events and click events).

preventDefaultinheritedpreventDefault: () => void;

Before-events and click events: cancels the action (or the built-in behavior).