Is it possible to create Columns without Data?
I want to use empty columns where I can put actions relating to the row like "VIEW" and "DELETE". I also want to ensure the useReactTable() model captures these empty columns because I want to be able to change the visibility of these columns programmatically using state and onColumnVisibilityChange
4 Replies
eastern-cyan•3y ago
That is possible. I just did something similar. You can render anything you want in each cell for a specific column. If you want a delete-button there. Just render it with the
cell: () => <DeleteButton />
or whateverautomatic-azureOP•3y ago
Does this mean I need to create a empty field in my Data Json Object?
rising-crimson•3y ago
You should define a
display
column https://tanstack.com/table/v8/docs/guide/column-defs#column-def-typesColumns | TanStack Table Docs
API
Table API
automatic-azureOP•3y ago
Thanks! that was helpful
I had the wrong assumption that the data had to match the column definitions