Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grand totals at bottom of columns #252

Open
mc-its-sorted opened this issue Mar 3, 2024 · 4 comments
Open

grand totals at bottom of columns #252

mc-its-sorted opened this issue Mar 3, 2024 · 4 comments
Labels
question Further information is requested

Comments

@mc-its-sorted
Copy link

hi

Awesome to use this in streamlit

I'm trying to get grand totals at the bottom of columns.

I'm trying this:

gb.configure_column(field='profit', sort='asc', groupIncludeTotalFooter=True, aggFunc='sum')

alas not working ... is this supported ?

Any help appreciated
Thanks
Mark

@PablocFonseca PablocFonseca added the question Further information is requested label Mar 21, 2024
@lomnes-atlast-food
Copy link

@mc-its-sorted It looks like the correct implementation is:

# Remove the groupIncludeFooter parameter from the configure_column method
gb.configure_column(field='profit', sort='asc', aggFunc='sum')

# Instead use the configure_grid_options method to include the groupIncludeFooter AND the groupIncludeTotalFooter parameters.
gb.configure_grid_options(groupIncludeFooter=True, groupIncludeTotalFooter=True)

@lomnes-atlast-food
Copy link

Ag-grid 31.3.0 changed how total rows are handled here: https://ag-grid.com/archive/31.3.0/javascript-data-grid/grouping-footers/

likely the new way to do this is:

gb.configure_grid_options(groupTotalRow='bottom', grandTotalRow ='bottom')

@mc-its-sorted
Copy link
Author

Thanks Steve

@lennondata
Copy link

lennondata commented May 15, 2024

Hello,

I'm able to get groupTotalRow and grandTotalRow showing as you described @lomnes-atlast-food, thank you! However, enabling these options now means that any edited cells are not tracked in my streamlit app:

gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_grid_options( ..., groupTotalRow='bottom', grandTotalRow='bottom',...)
gridOptions = gb.build()
# Display the grid
grid_response = AgGrid(
    df,
    gridOptions=gridOptions,
    allow_unsafe_jscode=True,
    data_return_mode=DataReturnMode.AS_INPUT,
    update_mode=GridUpdateMode.VALUE_CHANGED,
)

start streamlit app

grid_response.event_data is None # returns True

edit cell value

grid_response.event_data is None # returns True

This only happens when I enable groupTotalRow and grandTotalRow, otherwise cells edits are tracked in grid_response.event_data as type:cellValueChanged - anyone know what I might be missing?

Thanks,
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants