Is there an option that I’m missing that will re-fit the grid when the window size changes? It does it fine on first render, but when I resize the window, the columns all stay the same width.
Hey @cwhatley,
Have you tried adding ColumnsAutoSizeMode
to your imports and adding columns_auto_size_mode=ColumnsAutoSizeMode.FIT_ALL_COLUMNS_TO_VIEW,
to the AgGrid()
call?
Yes, but that only operates on the first load of the page and doesn’t make it respond to window resize. Minimal test.
import streamlit as st
import pandas as pd
import numpy as np
from st_aggrid import AgGrid, GridOptionsBuilder, ColumnsAutoSizeMode
data = pd.DataFrame(np.random.rand(2,3), columns=["a", "b", "c"])
gb = GridOptionsBuilder.from_dataframe(data)
grid_res = AgGrid(
data,
gridOptions=gb.build(),
theme='material',
columns_auto_size_mode=ColumnsAutoSizeMode.FIT_ALL_COLUMNS_TO_VIEW,
)