Edit dash bootstrap table (from_dataframe) columns

Hi!

I have one Dash Bootstrap Table with data that I filled using dbc.Table.from_dataframe(df), the problem is that I want to add a new column with a button to show more data for each row (“show more” button).

I don’t know how to add columns to the main table, I tried to create other dbc.Table() and append “childrens” but only appends 1 button at the final of the main table.

EDIT:

  • At the moment I have an approach that consist on defining dbc.Table without using “from_dataframe” method and fill individually table header and table body from source “df” and assign button inside html.Td() tag. I think it’s quite ugly this solution…

Any idea?
Thank you!

Hi @icychocolate00

Welcome to the forums.

I don’t know if I exactly understood your question, but generally interacting with the html components that are produced by Table.from_dataframe is a bit awkward. I would recommend actually adding a column to the dataframe, then completely regenerating the table using the new dataframe.

If you give a little more detail or share a minimal example of what you’re trying to do I’m happy to try and expand on my suggestion a bit

Hi @tcbegley !

I thought about adding that column before creating DataFrame but, at the final, I would need to add manually the “show more” button in each row, no?

Right now I have a working version where I generate each header and table TD individually with pd.iterTuples() - max page_size I let user select is about 50 and it’s working fine -