Displaying Ag grid table on the streamlit side bar

I have been trying to display the Ag Grid table on the sidebar of the streamlit UI. Currently able to display the Ag Grid table with all the functionalities that I want, just want to move to the sidebar and couldn’t find that option in anywhere. It would be great if anyone could help, below is my current code implementation.

import streamlit as st 
import pandas as pd
from st_aggrid import AgGrid, GridUpdateMode, JsCode
from st_aggrid.grid_options_builder import GridOptionsBuilder

# Functions
def data_upload():
    df = pd.read_csv("songs_normalize.csv") # some random csv file
    return df

#st.header("This is Streamlit Default Dataframe")
df = data_upload()
# st.dataframe(data=df)
# st.info(len(df))

gd = GridOptionsBuilder.from_dataframe(df)
# gd.configure_default_column(editable=True,groupable=True)
# sel_mode = st.radio('Selection Type', options = ['single', 'multiple'])
gridoptions = gd.build()
grid_table = AgGrid(df,gridOptions=gridoptions,
                    update_mode= GridUpdateMode.SELECTION_CHANGED,
                    height = 500,
                    #enable_enterprise_modules = True,
                    theme = 'blue')
# st.sidebar(grid_table)
sel_row = grid_table["selected_rows"]

Would this work?

with st.sidebar:

1 Like

Thanks, that helps.