T
TanStack3y ago
automatic-azure

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
eastern-cyan3y 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 whatever
automatic-azure
automatic-azureOP3y ago
Does this mean I need to create a empty field in my Data Json Object?
rising-crimson
rising-crimson3y ago
automatic-azure
automatic-azureOP3y ago
Thanks! that was helpful I had the wrong assumption that the data had to match the column definitions

Did you find this page helpful?