Export all data, serverSide rowModelType in Dash Aggrid

Hi Everyone,

I need to implement Dash Ag Grid with “server side” row model. I want to have export functionality in my app.
So how can I export all data in my df ?
If I use the following code, I can only export the first 100 rows in the df

clientside_callback(
    """function (n) {
        if (n) {
            dash_ag_grid.getApi("grid-excel-export").exportDataAsExcel();
        }
        return dash_clientside.no_update
    }""",
    Output("btn-excel-export", "n_clicks"),
    Input("btn-excel-export", "n_clicks"),
    prevent_initial_call=True
)

Please support me for this problem
Thank you so much

Hello @ducnv,

To get all the data from your server, you will need to use a custom button and not use the built in method.

Exporting from AG Grid will only show the currently rendered info.

1 Like

Hi @jinnyzor,
Thanks for your reply. Can you provide a sample code? My application needs a data export feature and when the excel file is exported it will need to have group, sort, like on aggrid. I tried some code but it doesn’t seem to work.
Thank you very much

If you want to have everything replicated, you can have a hidden grid and pass all of the entire data to that hidden grid upon clicking the button.

yes, thank you for your support

1 Like

Hi @ducnv and @jinnyzor, did you end up solving this issue? I’m facing a similar issue where I want to export all rows, not just the rendered rows, as a CSV.

I don’t fully understand what “have a hidden grid and pass all of the entire data to that hidden grid upon clicking the button” would mean. If we have a large amount of data, we probably don’t want to load all that data from the server and load to into a hidden grid, right? Can you explain further how you got a working export?

@spicycactus,

If you want to export your data without processing, I would recommend using the raw data from the backend in a callback and take the dataframe to a csv and use dcc.Download.