Reset data in Ag Grid after edits

So, I’m use @PablocFonseca 's EXCELLENT ag-grid component, but I’m up against a wall. I have an editable grid setup. But after the user has made some changes, I’d like to have a button that resets the contents. I’m just not what to set. Thanks.

gb = ag.GridOptionsBuilder.from_dataframe(orig_inputs)
gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, aggFunc='sum', editable=True, type=["numericColumn", "numberColumnFilter"])
gb.configure_column('FlowDate', enableRowGroup=True, aggFunc='sum', editable=False, type=["dateColumnFilter", "customDateTimeFormat"], custom_format_string='yyyy-MM-dd', pivot=True)
go = gb.build()

inputs = ag.AgGrid(orig_inputs, gridOptions=go, update_mode='MANUAL')['data']

Answer my own question:
AgGrid has a parameter called “reload_data” - if called with True, will reload the data from the input. (OW ignores it after initial input.)

this is my code:

    reload_data = False
    if st.button('Reset Inputs'):
        inputs = orig_inputs.copy()
        reload_data = True

    inputs = ag.AgGrid(inputs, gridOptions=go, reload_data=reload_data, update_mode='MANUAL')['data']
    reload_data = False

Hi @apassy ,

Why do you switch reload_data = False every time, and not leave it equal to True? (I am trying to understand this reload_data argument better.) Thanks in advance!

Because I don’t want it to reload every time the code re-runs. If the user has made edits, I want those preserved, unless they want to clear them out.