API / Plugins / Base / Resize

ColumnResizePlugin

Live demo|NPM

Constructor

new ColumnResizePlugin<T>(options?: ColumnResizePluginOptions<T>)

Options

Properties accepted by ColumnResizePluginOptions<T>.

Callbacks

onResize: (columnId: string, width: number) => void

Called with the column id and clamped width each time the width changes during a drag.

onResizeStart: (columnId: string, width: number) => void

Called when a drag begins, with the column id and its starting width.

onResizeEnd: (columnId: string, width: number) => void

Called when a drag completes, with the column id and its final width.

Instance methods

getColumnWidth(columnId): number | undefined

Returns the current width of a leaf column.

setColumnWidth(columnId, width): number

Sets a column width and clamps it to the configured min/max constraints.

setWidth(columnId, width): number

Alias for `setColumnWidth`.

resizeColumn(columnId, delta): number

Changes the width by a delta in pixels.

resize(columnId, delta): number

Alias for `resizeColumn`.

beginResize(columnId, clientX): number

Starts an interactive resize using the pointer x-coordinate.

handlePointerDown(columnId, clientX): number

Adapter-friendly alias for pointer-down events.

resizeTo(clientX): number

Updates the current resize using the new pointer x-coordinate.

handlePointerMove(clientX): number

Adapter-friendly alias for pointer-move events.

resizeBy(delta): number

Updates the current resize using an already-calculated delta.

endResize(): number

Completes the active pointer drag and hides the resize guide.

handleDoubleClick(columnId): number

Adapter-friendly alias for double-click auto-fit.

autoSizeColumn(columnId): number

Calculates the best-fit width from header text and visible row content.

autoFitColumn(columnId): number

Alias for `autoSizeColumn`.

getResizeGuide(): ColumnResizeGuide

Returns the current drag guide state for integrations.

clearGuide(): void

Resets the current drag guide state.

Types and Interfaces

ColumnResizeGuide

Live drag-guide state for the currently resizing column.

interface ColumnResizeGuide {
    /** ID of the column being resized. */
    columnId: string;
    /** Current pointer x-coordinate, in viewport pixels. */
    x: number;
    /** Whether the guide is currently visible. */
    visible: boolean;
}
ResizePluginOptions

Alias of {@link ColumnResizePluginOptions} with the `Column` prefix stripped for ergonomic construction.

type ResizePluginOptions<T> = ColumnResizePluginOptions<T>;