T
TanStack2y ago
xenial-black

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
xenial-black
xenial-blackOP2y 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()}<>,
},
];
rival-black
rival-black2y ago
Store your columns in the state and change the state based on your use

Did you find this page helpful?