Examples › Pinning the first column
fix, fixed, affix, sticky
Pinning the first column to the left side of the table could be useful when you have a table with many columns and you want to make sure the first column is always visible, even when the table is scrolled horizontally. For instance, you could use this feature to ensure that row actions placed on the first column are always visible.
You can achieve this by setting the pinFirstColumn
DataTable prop to true
:
Here is the code:
You can also combine this feature with row selection, in which case both the selection checkbox and the first user-provided column will be pinned to the left side of the table:
Here is the code:
You can use row selection and pin both the first and the last column at the same time:
Here is the code:
Using with column grouping
Here is an example of how you can pin the first column when using column grouping. Notice how the first group contains only one column, and how we are using an absolutely positioned custom title component to create the illusion that the Name text is centered vertically:
Here is the code:
Head over to the next example to discover more features.