bc-grid
GitHub

Pinned columns

View source

Pin columns to either edge of the viewport so they never scroll out of view. Order # and Customer are pinned left; Amount is pinned right.

Order #
Customer
Sales rep
Region
Opened
Status
Amount
R-000001
Customer 00001
Avery Chen
North
2024-01-01
active
$0.00
R-000002
Customer 00002
Ben Singh
North
2024-08-14
pending
$31.42
R-000003
Customer 00003
Cara Diaz
North
2024-03-27
closed
$62.83
R-000004
Customer 00004
Drew Lin
North
2024-10-13
active
$94.25
R-000005
Customer 00005
Elena Park
South
2024-05-26
pending
$125.66
R-000006
Customer 00006
Felix Roy
South
2024-12-12
closed
$157.08
R-000007
Customer 00007
Gita Bose
South
2024-07-25
active
$188.50
R-000008
Customer 00008
Henry Kao
South
2024-02-11
pending
$219.91
R-000009
Customer 00009
Avery Chen
East
2024-09-24
closed
$251.33
R-000010
Customer 00010
Ben Singh
East
2024-04-10
active
$282.74
R-000011
Customer 00011
Cara Diaz
East
2024-11-23
pending
$314.16
R-000012
Customer 00012
Drew Lin
East
2024-06-09
closed
$345.57
R-000013
Customer 00013
Elena Park
West
2024-01-22
active
$376.99
R-000014
Customer 00014
Felix Roy
West
2024-08-08
pending
$408.41
R-000015
Customer 00015
Gita Bose
West
2024-03-21
closed
$439.82

Try this

Watch the pinned lanes stay put while the middle scrolls.

  • Scroll horizontally — Order # and Customer stay glued to the left.
  • Same scroll — Amount stays glued to the right.
  • Right-click the Amount header → "Unpin" to move it back into the unpinned lane.
  • Right-click any other column header → "Pin left" / "Pin right".

How pinning works

  • Three lanes.The grid renders three column lanes — pinned left, scrollable middle, pinned right — that share a single virtualizer. The middle lane scrolls horizontally; the pinned lanes don't.
  • Sticky vertically too. Pinned columns inherit row virtualization. Scroll vertically through 10,000 rows and only the rows in viewport mount.
  • Range select across lanes. Drag a range from a pinned cell into the middle lane and back out. The rectangle is contiguous and copy-as-TSV preserves the order.
  • Composes with master/detail. Detail panels open inside the row across all three lanes. Pinned cells render the chevron when on the outline column.

API

Set pinned: "left" or pinned: "right" on the column. Omit the prop to leave it in the unpinned lane. The context menu and the column-visibility panel both let the end user re-pin at runtime; persisted via layoutState.