streamlit-aggrid
streamlit-aggrid copied to clipboard
Adjustable table height
Hi! First of all, I would like to say a big thanks to the creators of AgGrid! Great work and a very cool component! :)
I would like to ask if you have thought maybe about the possibility of automatic height adjustment? It would be great if you could give some flag like adjust_height=True and the height parameter would be the maximum height to which the table can stretch. I ask about it, because in case of height defined for specific value like 500, in case of smaller number of data there is a lot of empty space left, which could dynamically shrink. Or maybe there is already some way to achieve something similar?
Thanks for your answer and best regards!
check https://streamlit-aggrid.readthedocs.io/en/docs/GridOptionsBuilder.html#st_aggrid.grid_options_builder.GridOptionsBuilder.configure_auto_height
Hello @PablocFonseca , fantastic library!
I just have one question, how can we specify height to be adjustable to the number of rows in the table? for example: I have table with 1 row but shows in addition to that empy space below this row.
Hi @rhajou. If autoHeight
does not meet your needs, you can use some custom logic. For example:
MIN_HEIGHT = 50
MAX_HEIGHT = 800
ROW_HEIGHT = 60
AgGrid(df, height=min(MIN_HEIGHT + len(df) * ROW_HEIGHT, MAX_HEIGHT))
Hello @ghilesmeddour , thank you I just figured that out as well :) ! Although I think the best values are:
MIN_HEIGHT = 27 MAX_HEIGHT = 800 ROW_HEIGHT = 35