Ag-Grid component with input support

Can anybody help me with this problem:

  1. I need a table where I can display rows grouped by one column.
  2. But at the same time all rows should be selectable with checkboxes. So that I can download the selected rows only via a download button.
    I can get the grouped rows to work and also the selectable rows but not at the same time (checkboxes don’t show up).
    Is that even possible at the moment?

Here’s my code (grouped rows):
gb = GridOptionsBuilder.from_dataframe(ticker_table) gb = GridOptionsBuilder.from_dataframe(ticker_table) gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, aggFunc='count', editable=False, min_column_width=300) gb.configure_column('Name', rowGroup=True, pivot=True, hide=True) gb.configure_column('URLs', header_name='URLs', cellRenderer=JsCode('''function(params) {return '<a href="' + params.value + '" target="_blank">' + params.value + '</a>'}''')) gb.configure_selection() gridOptions = gb.build()

Many thanks

Hi, is there a way to implement a boolean checkbox in a column? I am trying with the cellRenderer option with no luck so far… Thanks in advance

@PablocFonseca thank you so much for creating this Ag-Grid integration, it’s super useful. Just wanted to let you know that I’m encountering exactly the same issue as @dmenini - only the upper two rows are displayed when using gb.configure_auto_height()!

Hi again everyone,

Can someone explain what is the effect of assigning update_mode = GridUpdateMode.MODEL_CHANGED in the main AgGrid() function? All other update modes are self-explanatory except this one.

Thanks in advance!

Hello everyone,

I have a small model in Excel to project sales and profits (see below). I would like to publish it in streamlit to let users edit the blue parts directly in an app (instead of Excel).

Has anyone ever built something like that in streamlit using Ag-Grid (or anything else)? Is that feasible (with the formats, etc.)

Many thanks for your help!

Hi @PablocFonseca, this would be indeed very helpful!

Hello everyone
I’m trying various things with streamlit-aggrid, but I want to display Sparkline in some columns of python’s pandas data frame. What is the method?

Hi all, I’ve run into a weird bug where using the pre_selected_rows option causes Ag-Grid to repeatedly re-render in my app in an endless loop (see code below). If I simply turn off this option, everything works fine. Has any one else run into this and might have some pointers?

# DATA VIZ & REPORTING PAGE
elif app_page == "Visualize & Report":

    # if user comes here without first selecting data...
    if st.session_state.user_selected_data.size == 0:
        st.error("Oops!  No summary table of data has been created yet. Please use to the 'Search & Filter' page to create a summary table of sealants data.  Afterward, return to this page to build visualizations and/or reports of that data.")
    else:

        st.markdown("### Summary Table")

        # display interactive table of data returned from above search & filter
        gb_graph = GridOptionsBuilder.from_dataframe(st.session_state.user_selected_data)
        gb_graph.configure_pagination()
        gb_graph.configure_selection(selection_mode="multiple", use_checkbox=True, pre_selected_rows=[1,2,3])
        user_selected_data = AgGrid(st.session_state.user_selected_data, gridOptions=gb_graph.build(), update_mode=GridUpdateMode.SELECTION_CHANGED)
        graph_data = pd.DataFrame(user_selected_data["selected_rows"])

1 Like

Howdy!
Does anyone know how to change the default font-size for both headers and rows?
Thanks in advance!!

Does anybody know, why NULLs come into aggrid as strings containing ‘None’? I have tried to explore if any grid parameters are responsible for that, no idea so far…

Hi @dmenini I am not sure if this is what you were after but these to keywords will stick checkboxes in the columns.

gb.configure_default_column(checkboxSelection=False, headerCheckboxSelection=True)

The first puts checkboxes in every cell (not super useful) the second stick a checkbox in the column header.

Hi, when we use the enterprise modules (either with the sidebar or without) and we deselect some column/s so it/they is/are not displayed is it possible to get the new reduced view returned or to find out what columns are hidden.If something changes it still returns all of the columns but in my code I have no way of determining what the user didn’t want to see. This is something I am chasing for dynamic plotting where I might do a stacked bar plot but the user wants the option to turn columns on or off.

In this case short of deselecting them prior to constructing the AgGrid I cant find out how to get the information out of AgGrid. If I have to do that then hiding the columns in the grid but selecting/deselecting is just for looks only yes?

1 Like

could you please provide a gist, or even open an issue at Issues · PablocFonseca/streamlit-aggrid · GitHub , please?

MODEL_CHANGED is a bitwise combination of all other flags, grid will update if any of previous triggger.

class GridUpdateMode(IntFlag):
    NO_UPDATE = 0b0000
    MANUAL = 0b0001
    VALUE_CHANGED = 0b0010
    SELECTION_CHANGED = 0b0100
    FILTERING_CHANGED = 0b1000
    SORTING_CHANGED = 0b10000
    MODEL_CHANGED = 0b11111 #bitwise combination of all
1 Like

I think it is doable with custom CSS injection from last version. I’ll try to code an example.
Could you please open an issue on github repo?

how to change the table text in bold as you used in TEAM?

how to change the font in bold? can any one explain me? it is possible or not!

1 Like

Go to AgGrid documentation and search for getRowStyle, use Javascript

Hi, I am wondering how I can change the font size of AgGrid. Thanks a lot!

Love the package! However, I’ve been having trouble implementing this functionality: How to add buttons in ag-Grid cells. Did anyone have any success with this?