How can i add a drop down based option to a cell for user convenience in streamlit using aggrid

I’ve been struggling for hours, can somebody help.


How can i add a drop down to a cell of a table created with or without using aggird inside a streamlite environment (python). Can somebody help on this. I need a drop down as “Long” or “Short” in the “Long/Short” column of the table rather than a manual text input. Thanks in advance.

Hi there,

Thanks for sharing your question with the community! Check out our guidelines on how to post an effective question here – in particular, please include a code snippet so we can make relevant suggestions.

Caroline :balloon:

Hi @Mr_John, check if the following code is what you are looking for:

import streamlit as st
import pandas as pd
from st_aggrid import GridOptionsBuilder, AgGrid

NameList = ('a', 'b', 'c', 'd', 'e')
df = pd.DataFrame({'Name': ['a', 'b', 'c']})
gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_column("Name", editable=True, cellEditor='agSelectCellEditor', cellEditorParams={'values': NameList }) 

vgo = gb.build()
AgGrid(df, gridOptions=vgo, theme='blue')

Cheers

Thanks a lot,Sir. It worked. Bless you. :heart: :heart: :heart:

1 Like