Skip to content
Data TableExamples

Pin columns and restore their layout

comins-table@0.2.2React

Pin Name left and Status right, then check horizontal scrolling, a narrow container, and layout restoration.

  1. Scroll the horizontal scrollbar right. Name and Status stay at their respective edges while Team, Email, and Region scroll.
  2. Select Save layout → Unpin columns. All columns enter the center zone. Restore layout brings the pins back.
  3. Select 260px width. When pinned widths exceed the available space, some pins temporarily enter the scrolling zone.
  4. Use Inspect configuration to confirm that pinned is retained. Return to Full width to recover effective pinning when space permits.
Value/API Purpose
columns[].pinned Sets initial "left" or "right" pinning.
getColumnLayout() Reads current order, width, visibility, and pin configuration.
setColumnLayout(layout) Reapplies that structure; it does not restore source row data.
onChangeColumnLayout Updates the example’s displayed layout JSON.

The save button keeps an in-memory snapshot which is lost on page reload. Use layouts compatible with the same column IDs. Reading and writing happen in separate user events.

The package reserves at least 48px for center content. If pins exceed that budget, it temporarily demotes inner blocks from the wider side; ties prefer the right side. This example uses 140px left and 130px right. At 260px, Name can lose its effective pin while its saved pinned: "left" configuration remains intact.

Demotion does not change configuration or emit onChangeColumnLayout. The direct resize limit of a pinned column differs from temporary demotion on container resize.

This example covers individual flat-data Header/Body columns. It does not verify all Header Group, Summary boundary, resize gesture, or Tree combinations. Column Pinning is unavailable in Tree mode.

Column pinning guide · getColumnLayout · setColumnLayout