ShakibDShy

Column Pinning Example

Learn how to pin table columns using React Table Grid

This example demonstrates how to pin columns to the left or right of a table, ensuring that essential data remains visible during horizontal scrolling.

Overview

In this example, you will learn how to:

  • Define columns with the pinned property
  • Fix columns to the left or right
  • Monitor table state changes with pinned columns

Example

Column Pinning

ID
Name
Salary
Status
Location
Phone
Email
Department
Role
Join Date
Join Date
1
John Doe
$85,000
Active
New York
+1 (555) 123-4567
john.doe@company.com
Engineering
Software Engineer
2023-01-15
2023-01-15
10
Jennifer Martinez
$98,000
Active
San Diego
+1 (555) 012-3456
jennifer.m@company.com
Engineering
DevOps Engineer
2022-02-28
2022-02-28
11
William Clark
$86,000
Active
Phoenix
+1 (555) 123-4567
william.c@company.com
Finance
Senior Accountant
2021-05-17
2021-05-17
12
Emma Rodriguez
$72,000
Active
Las Vegas
+1 (555) 234-5678
emma.r@company.com
Marketing
Digital Marketing
2023-03-08
2023-03-08
13
Daniel White
$80,000
Active
Minneapolis
+1 (555) 345-6789
daniel.w@company.com
Engineering
QA Engineer
2022-09-12
2022-09-12
14
Sophia Lee
$70,000
Active
Detroit
+1 (555) 456-7890
sophia.l@company.com
HR
HR Specialist
2023-01-20
2023-01-20
15
Christopher Moore
$95,000
Active
Atlanta
+1 (555) 567-8901
chris.m@company.com
Sales
Sales Manager
2021-11-05
2021-11-05
16
Olivia Garcia
$76,000
Active
Houston
+1 (555) 678-9012
olivia.g@company.com
Engineering
UI Designer
2022-07-30
2022-07-30
17
Andrew Wilson
$120,000
Active
Philadelphia
+1 (555) 789-0123
andrew.w@company.com
Finance
Finance Director
2020-12-15
2020-12-15
18
Isabella Thompson
$84,000
Active
San Jose
+1 (555) 890-1234
isabella.t@company.com
Marketing
Brand Manager
2022-04-25
2022-04-25
19
Matthew Brown
$105,000
Active
Dallas
+1 (555) 901-2345
matthew.b@company.com
Engineering
System Architect
2021-08-09
2021-08-09
2
Jane Smith
$92,000
Inactive
San Francisco
+1 (555) 234-5678
jane.smith@company.com
Marketing
Marketing Manager
2022-08-20
2022-08-20
20
Ava Martinez
$73,000
Active
Sacramento
+1 (555) 012-3456
ava.m@company.com
Sales
Sales Representative
2022-10-17
2022-10-17
21
Ethan Anderson
$110,000
Active
New York
+1 (555) 123-4567
ethan.a@company.com
Engineering
Lead Developer
2021-02-14
2021-02-14
22
Mia Johnson
$82,000
Active
San Francisco
+1 (555) 234-5678
mia.j@company.com
HR
Recruitment Manager
2022-05-30
2022-05-30
23
Alexander Davis
$98,000
Active
Chicago
+1 (555) 345-6789
alex.d@company.com
Finance
Financial Controller
2021-12-07
2021-12-07
24
Charlotte Wilson
$71,000
Active
Boston
+1 (555) 456-7890
charlotte.w@company.com
Marketing
SEO Specialist
2023-02-11
2023-02-11
25
Benjamin Taylor
$88,000
Active
Seattle
+1 (555) 567-8901
ben.t@company.com
Engineering
Mobile Developer
2022-01-19
2022-01-19
26
Amelia Moore
$79,000
Active
Austin
+1 (555) 678-9012
amelia.m@company.com
Sales
Business Developer
2022-08-05
2022-08-05
27
Henry Garcia
$94,000
Active
Miami
+1 (555) 789-0123
henry.g@company.com
Finance
Risk Analyst
2021-06-22
2021-06-22
28
Victoria Lee
$68,000
Active
Portland
+1 (555) 890-1234
victoria.l@company.com
HR
Training Coordinator
2023-01-09
2023-01-09
29
Sebastian Clark
$96,000
Active
Denver
+1 (555) 901-2345
sebastian.c@company.com
Engineering
Data Engineer
2022-03-14
2022-03-14
3
Robert Johnson
$115,000
pending
Chicago
+1 (555) 345-6789
robert.j@company.com
Sales
Sales Director
2021-03-10
2021-03-10
30
Scarlett White
$74,000
Active
San Diego
+1 (555) 012-3456
scarlett.w@company.com
Marketing
Social Media Manager
2022-11-28
2022-11-28
31
Jack Thompson
$89,000
Active
Phoenix
+1 (555) 123-4567
jack.t@company.com
Sales
Key Account Manager
2021-09-03
2021-09-03
32
Luna Rodriguez
$77,000
Active
Las Vegas
+1 (555) 234-5678
luna.r@company.com
Engineering
UX Designer
2023-04-17
2023-04-17
33
Owen Martinez
$83,000
Active
Minneapolis
+1 (555) 345-6789
owen.m@company.com
Finance
Budget Analyst
2022-02-08
2022-02-08
34
Elena Anderson
$69,000
Active
Detroit
+1 (555) 456-7890
elena.a@company.com
HR
Benefits Coordinator
2022-10-11
2022-10-11
35
Lucas Brown
$99,000
Active
Atlanta
+1 (555) 567-8901
lucas.b@company.com
Engineering
Security Engineer
2021-07-26
2021-07-26
36
Aria Davis
$76,000
Active
Houston
+1 (555) 678-9012
aria.d@company.com
Marketing
Product Marketing
2022-12-19
2022-12-19
37
Leo Wilson
$87,000
Active
Philadelphia
+1 (555) 789-0123
leo.w@company.com
Sales
Sales Operations
2021-04-05
2021-04-05
38
Zoe Garcia
$97,000
Active
San Jose
+1 (555) 890-1234
zoe.g@company.com
Engineering
Cloud Engineer
2022-06-30
2022-06-30
39
Max Lee
$91,000
Active
Dallas
+1 (555) 901-2345
max.l@company.com
Finance
Investment Analyst
2022-09-15
2022-09-15
4
Emily Davis
$78,000
Active
Boston
+1 (555) 456-7890
emily.d@company.com
Engineering
Frontend Developer
2023-04-05
2023-04-05
40
Lily Moore
$81,000
Active
Sacramento
+1 (555) 012-3456
lily.m@company.com
HR
HR Business Partner
2023-01-23
2023-01-23
41
Noah Clark
$108,000
Active
New York
+1 (555) 123-4567
noah.c@company.com
Engineering
Technical Lead
2021-10-12
2021-10-12
42
Aurora White
$73,000
Active
San Francisco
+1 (555) 234-5678
aurora.w@company.com
Marketing
Marketing Analyst
2023-03-28
2023-03-28
43
Elijah Thompson
$112,000
Active
Chicago
+1 (555) 345-6789
elijah.t@company.com
Sales
Enterprise Sales
2021-05-31
2021-05-31
44
Maya Rodriguez
$103,000
Active
Boston
+1 (555) 456-7890
maya.r@company.com
Engineering
ML Engineer
2022-08-22
2022-08-22
45
Gabriel Martinez
$85,000
Active
Seattle
+1 (555) 567-8901
gabriel.m@company.com
Finance
Tax Specialist
2022-01-10
2022-01-10
46
Ruby Anderson
$72,000
Active
Austin
+1 (555) 678-9012
ruby.a@company.com
HR
Talent Acquisition
2023-02-06
2023-02-06
47
Adrian Brown
$106,000
Active
Miami
+1 (555) 789-0123
adrian.b@company.com
Engineering
DevOps Manager
2021-11-15
2021-11-15
48
Stella Davis
$78,000
Active
Portland
+1 (555) 890-1234
stella.d@company.com
Marketing
Events Manager
2022-07-11
2022-07-11
49
Felix Wilson
$93,000
Active
Denver
+1 (555) 901-2345
felix.w@company.com
Sales
Channel Partner Manager
2021-08-30
2021-08-30
5
Michael Wilson
$95,000
pending
Miami
+1 (555) 567-8901
michael.w@company.com
Finance
Financial Analyst
2020-11-30
2020-11-30
50
Hazel Garcia
$90,000
Active
San Diego
+1 (555) 012-3456
hazel.g@company.com
Engineering
Full Stack Developer
2022-04-04
2022-04-04
6
Sarah Brown
$88,000
Inactive
Seattle
+1 (555) 678-9012
sarah.b@company.com
HR
HR Manager
2022-06-15
2022-06-15
7
David Lee
$92,000
Active
Austin
+1 (555) 789-0123
david.l@company.com
Engineering
Backend Developer
2021-09-22
2021-09-22
8
Lisa Anderson
$75,000
Active
Portland
+1 (555) 890-1234
lisa.a@company.com
Marketing
Content Strategist
2022-12-01
2022-12-01
9
James Taylor
$82,000
Active
Denver
+1 (555) 901-2345
james.t@company.com
Sales
Account Executive
2021-07-14
2021-07-14

Key Concepts

  • Pinned Columns: Use the pinned attribute ("left" or "right") to fix a column.
  • State Monitoring: The onStateChange callback allows you to track how pinned columns affect table state.

Customization Tips

  • Adjust column widths via the width property for improved layout.
  • Combine column pinning with other features like column resizing for a dynamic interface.

Next Steps

Last updated on

On this page