Skip to content

@jsvision/datagrid / partition

Function: partition() ​

partition(visible, freeze): FreezePartition

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

Partition the visible ids into left / center / right panels from a freeze spec. Left/right slices keep their visible-order sequence; everything not frozen is center. Ids in the freeze spec that are not present in visible are ignored (an unknown or hidden frozen id simply isn't placed).

Parameters ​

visible ​

readonly string[]

The visible column ids, in order.

freeze ​

FreezeSpec

The freeze spec (freezeLeft/freezeRight take precedence over freeze).

Returns ​

FreezePartition

The three ordered id slices.

Example ​

ts
import { partition } from '@jsvision/datagrid';
partition(['id', 'name', 'dept', 'note'], { freezeLeft: ['id'], freezeRight: ['note'] });
// { left: ['id'], center: ['name', 'dept'], right: ['note'] }
partition(['id', 'name', 'dept'], { freeze: 2 });
// { left: ['id', 'name'], center: ['dept'], right: [] }