[column-visibility] How to display the header of a column instead of the column.id
?
#4857
Replies: 3 comments 6 replies
-
Just don't use column.id. use column.columnDef.header |
Beta Was this translation helpful? Give feedback.
-
as @IudexSoren said, you can use
Then you can access it:
|
Beta Was this translation helpful? Give feedback.
-
I ran into the same problem and ended-up using flexRender(column.columnDef.header, {
table,
column,
header: {column} as Header<unknown, unknown>,
}) You can replace Since we don't have direct access to |
Beta Was this translation helpful? Give feedback.
-
Looking at https://tanstack.com/table/v8/docs/examples/react/column-visibility
the box to show the columns to toggle uses:
and in particular
column.id
to display the label.But how to use actual header value here? E.g. in this example
Last Name
instead oflastName
...Beta Was this translation helpful? Give feedback.
All reactions