ShakibDShy

Toggle Column Pinning Example

Learn how to interactively toggle column pinning options in React Table Grid

This example demonstrates how to toggle column pinning interactively. It shows how you can allow users to pin or unpin columns dynamically.

Overview

In this example, you will learn how to:

  • Enable interactive column pinning
  • Toggle columns between pinned and unpinned states
  • Monitor state changes when column pinning is modified

Example

Toggle Column Pinning

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

Key Concepts

  • Interactive Pinning: Toggle column pinning on the fly.
  • State Management: Manage pinned column state outside of the TableGrid.
  • Customization: Dynamically update column properties based on user interaction.

Customization Tips

  • Extend the toggle functionality to support both left and right pinning.
  • Style toggle buttons for clear user feedback.

Best Practices

  • Ensure the table remains responsive when toggling pinning.
  • Test across devices to ensure a smooth interactive experience.

Next Steps

Last updated on

On this page