T
TanStack2y ago
mute-gold

Dynamically change the header of a column

Is there a way to dynamicaly change the header of a column? For example, if I pass a boolean of true, I want to render a 'True' for the header, and if its false, I want to render 'False'
2 Replies
mute-gold
mute-goldOP2y ago
Something like context.getValue() that we can access in cell Something like this?
const columns: ColumnDef<CustomerFileAdTableType>[] = [
{
accessorKey: 'comment',
header: (context) => <>{context.getValueMaybe()}<>,
},
];
const columns: ColumnDef<CustomerFileAdTableType>[] = [
{
accessorKey: 'comment',
header: (context) => <>{context.getValueMaybe()}<>,
},
];
optimistic-gold
optimistic-gold2y ago
Store your columns in the state and change the state based on your use

Did you find this page helpful?