Overview
TeeGrid supports three locking modes for columns:- None — Column scrolls normally with other columns
- Left — Column is locked to the left edge of the grid
- Right — Column is locked to the right edge of the grid
Basic Usage
Locking a Column
Locking by Index
Column Lock Types
Visual Differentiation
Visually distinguish locked columns from scrollable ones:Complete Example
Here’s a complete example from the TeeGrid demos showing locked columns:Interactive Locking
Allow users to lock/unlock columns at runtime:Context Menu for Column Locking
Locked Column Borders
Add visual separators between locked and scrollable columns:Checking for Locked Columns
Saving and Restoring Lock State
Locked Columns with Selection
Locked columns work seamlessly with cell selection and range selection:Performance Considerations
Painting optimization
Painting optimization
TeeGrid optimizes painting of locked columns. Locked columns are only repainted when necessary, not during horizontal scrolling.
Locked column count
Locked column count
While there’s no hard limit on locked columns, keeping the count reasonable (2-4 on each side) provides the best user experience and performance.
Width calculations
Width calculations
Locked columns reduce the available space for scrollable columns. Ensure your locked columns don’t consume too much horizontal space.
Best Practices
Common Use Cases
Financial data grids
Financial data grids
Lock account name/number columns to the left, and total/balance columns to the right.
Inventory management
Inventory management
Lock product ID and name to the left, with action buttons (edit/delete) locked to the right.
Contact lists
Contact lists
Lock name column to the left so it remains visible while scrolling through many contact detail columns.
Log viewers
Log viewers
Lock timestamp column to the left for time reference while viewing log details.
Related Topics
Columns
Learn about column configuration and properties
Selection
Work with cell and range selection
Styling
Customize column appearance
TColumn API
Complete API reference for columns
