Dash Table Resizing

I have a dash app which, upon opening, I have three tables that must be pre-populated as empty, as I want the user to open the page, and then click a button to perform the calculations required to fill the tables.

Therefore, I have to preset the number of columns for these tables, as their final size is only known after the calculation is run. (The reason I can’t run the calculation before populating the tables is that throughout the day, the results of this calculation may change, and hence the size of the tables could also change throughout the day).

Currently, this means I have to oversize the table, meaning I have multiple empty columns sitting at the end of my data taking up space. Is there a way to have the container’s columns resize to fit the shape of the data I want to display, instead of hard coding a generous number at the beginning?


If anyone gets to this point and has a similar problem, you have to set the datatable to have deletable columns, and parse in the columns property as a state, and return it as an output.
Within the callback you alter the list of dicts that the columns property is to contain the relevant columns and then the container will resize.