Skip to content

@jsvision/datagrid / overPinnedIds

Function: overPinnedIds()

overPinnedIds(part, widthOf, viewportWidth): string[]

Defined in: datagrid/src/column-model.ts:173

The frozen column ids to un-pin so the center panel keeps at least one cell — i.e. the columns that make the total frozen width meet or exceed the viewport. Peels the innermost frozen column (nearest the center: the left panel's last, then the right panel's first) until the frozen total fits under viewportWidth − 1. Returns [] when everything already fits. The container moves the returned ids to the center and emits a single dev warning (the center is therefore never blank).

Parameters

part

FreezePartition

The current freeze partition.

widthOf

(id) => number

The resolved width (in cells) of a column id.

viewportWidth

number

The grid's usable width in cells.

Returns

string[]

The frozen ids to un-pin (innermost-first), or [] when the frozen columns fit.

Example

ts
import { overPinnedIds } from '@jsvision/datagrid';
// two 10-wide frozen columns in a 15-wide viewport → drop the innermost:
overPinnedIds({ left: ['a', 'b'], center: ['c'], right: [] }, () => 10, 15); // ['b']