PablocFonseca / streamlit-aggrid

Implementation of Ag-Grid component for Streamlit
https://pypi.org/project/streamlit-aggrid/
MIT License
991 stars 191 forks source link

onGridReady passed in via gridOption is not used #226

Open daniellowtw opened 1 year ago

daniellowtw commented 1 year ago

I noticed that passing onGridReady handler in

    grid_option_builder.configure_grid_options(
        onGridReady=st_aggrid.JsCode("""
        function(params) { 
        alert(1);
        }
        """)
    )

does not get triggered but changing onGridReady to onCellClicked works. Upon digging into the code, I noticed that when instantiating the <AgGridReact> component (src), onGridReady is explicitly passed in as a react prop. This will overwrite whatever value passed in by the user in gridOption (src).

This prevents downstream streamlit apps from hooking into this event, which I think severely limits customization (such as setting default filters based on other streamlit components.

I think the field passed in by the user in gridOption should be chained to the one defined defined in the React component provided by this library.