T
TanStack3y ago
foreign-sapphire

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
foreign-sapphire
foreign-sapphireOP3y ago
Does this mean I need to create a empty field in my Data Json Object?
extended-salmon
extended-salmon3y ago
foreign-sapphire
foreign-sapphireOP3y 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?