Hi everyone,
I’m using the streamlit-aggrid
component with the material
theme in my Streamlit app. However, I’ve recently noticed that the theme is not being applied as expected. After checking the browser console, I saw the following error:
[Error] AG Grid: error #200 (2)
"Unable to use sideBar as SideBarModule is not registered. Check if you have registered the module:
import { ModuleRegistry } from 'ag-grid-community';
import { SideBarModule } from 'ag-grid-enterprise';
ModuleRegistry.registerModules([ SideBarModule ]);
For more info see: https://www.ag-grid.com/react-data-grid/modules/"
"
See https://www.ag-grid.com/react-data-grid/errors/200?_version_=33.0.3&gridId=1&gridScoped=false&rowModelType=clientSide&moduleName=SideBar&reasonOrId=sideBar"
Ke (main.10356bea.js:2:296814)
Xe (main.10356bea.js:2:297260)
at (main.10356bea.js:2:298436)
gt (main.10356bea.js:2:299658)
assertModuleRegistered (main.10356bea.js:2:890967)
(anonymous function) (main.10356bea.js:2:1030051)
forEach
(anonymous function) (main.10356bea.js:2:1030014)
forEach
processOptions (main.10356bea.js:2:1029248)
processGridOptions (main.10356bea.js:2:1023947)
postConstruct (main.10356bea.js:2:1023821)
forEach
initBeans (main.10356bea.js:2:350074)
init (main.10356bea.js:2:349655)
init (main.10356bea.js:2:350744)
yo (main.10356bea.js:2:349173)
bo
create (main.10356bea.js:2:947701)
(anonymous function) (main.10356bea.js:2:1313986)
ol (main.10356bea.js:2:228502)
Cl (main.10356bea.js:2:236584)
bl (main.10356bea.js:2:235526)
yl (main.10356bea.js:2:235062)
(anonymous function) (main.10356bea.js:2:246899)
xd (main.10356bea.js:2:247412)
od (main.10356bea.js:2:239872)
w (main.10356bea.js:2:266003)
E (main.10356bea.js:2:266537)
Here is the code I’m using to create the table and set the material
theme:
def create_table(df):
gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_selection(selection_mode="single", use_checkbox=False)
gb.configure_pagination(paginationAutoPageSize=False, paginationPageSize=5)
gb.configure_default_column(editable=False, groupable=True)
gb.configure_pagination(paginationPageSize=20)
gb.configure_column("context_key", hide=True)
gridOptions = gb.build()
custom_css = {
".ag-row:nth-child(even)": {
"background-color": "#f2f2f2" # Light gray for even rows
},
".ag-row:nth-child(odd)": {"background-color": "#ffffff"}, # White for odd rows
}
num_rows = len(df)
grid_height = 120 + min(5, num_rows) * 60
return gridOptions, custom_css, grid_height
grid_options, custom_css, grid_height = create_table(df)
selection = AgGrid(
_data,
gridOptions=grid_options,
enable_enterprise_modules=False,
custom_css=custom_css,
theme="material", # Specifying the material theme
height=grid_height,
update_mode=GridUpdateMode.MODEL_CHANGED,
fit_columns_on_grid_load=True
)
(The application is deployed on an EC2, this issue started happening recently)