Hiding column in a table

I have a table that consists of 10 columns and I have checkboxes for each column such that when a user checks or unchecks the relevant column will show or hide. When the table loads there are specific columns that are shown and others that hidden, my problem is that when I check and then uncheck the same column an empty space is shown to the far right of the table and as I uncheck more columns that empty space increases. Also, When the table is loaded there is a scrollbar that is shown, at the beginning can scroll but small white space is shown which is not mentionable but as I check and uncheck the scrollbar increases and can be used to show the empty space.

I’ve dealt with hiding columns in Bubble tables before, and the best way was using conditional formatting. I set visibility rules based on user roles or field values, like “This element is visible when X is true.” If you’re using a repeating group, each column can be wrapped in a group with its own condition. Works great for dashboards with role-based access.