streamlit-aggrid
streamlit-aggrid copied to clipboard
Auto size all columns not work as expected
The current implementation of the columns_auto_size_mode=ColumnsAutoSizeMode.FIT_CONTENTS
feature may not be working as expected. It seems that only some columns are properly sized and that you need to click the "Autosize Columns" button once to ensure that all columns are sized correctly.
Could this be related to auto sizing limitations due to virtualization? https://www.ag-grid.com/javascript-data-grid/column-sizing/#auto-size-columns
Wait your new release, thank you for your help.
Could this be related to auto sizing limitations due to virtualization? https://www.ag-grid.com/javascript-data-grid/column-sizing/#auto-size-columns
Thank you, this fixed it for me. In case anyone having the same problem wants to know how to implement it, this is my code:
from st_aggrid import GridOptionsBuilder, AgGrid, ColumnsAutoSizeMode
df = ### make your pandas dataframe ###
gb = GridOptionsBuilder.from_dataframe(df)
other_options = {'suppressColumnVirtualisation': True}
gb.configure_grid_options(**other_options)
gridOptions = gb.build()
grid = AgGrid(df, gridOptions=gridOptions, columns_auto_size_mode=ColumnsAutoSizeMode.FIT_CONTENTS)