Skip to content

resolveColumnPaste

Since v3.0.0

Resolve a column’s ColumnPasteGuard (onPaste) for a single cell.

Pure — never mutates or emits. Exposed so a custom pasteHandler can honor per-column onPaste identically to defaultPasteHandler: call it per cell, write resolution.value when accepted, and collect the rejected cells to pass to emitPasteRejected.

function resolveColumnPaste(onPaste: ColumnPasteGuard<unknown, unknown> | undefined, ctx: PasteCellContext): PasteResolution
NameTypeDescription
onPasteColumnPasteGuard<unknown, unknown> | undefinedThe column’s onPaste config (column.onPaste), if any.
ctxPasteCellContextThe cell context (value, field, row, rowIndex, oldValue, sourceField).
// Inside a custom pasteHandler:
const rejected: PasteRejectedCell[] = [];
const res = resolveColumnPaste(column.onPaste, { value, field, row, rowIndex, oldValue });
if (res.accepted) row[field] = res.value;
else rejected.push({ field, rowIndex, row, value, reason: res.reason });
// …after writing all cells:
emitPasteRejected(grid, rejected);
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://toolboxjs.com/llms-full.txt