Dash AG Grid: Is there a callback on header sort click?

Hi everyone!

I have a Dash AG Grid table where I’ve configured a custom pagination component so that I can do custom pagination. My data is very large, so I fetch it page by page.

I’d also like to configure sorting similarly, too. Currently I fetch just 100 rows at a time, so if I click on the header to sort, it only sorts those 100 rows. Is there some sort of callback I can use to detect when the header/sort button is clicked so that I can update rowData?

Something along the lines of

@callback(
  Output("my-table", "rowData"),
  Input("my-table", "HEADER_SORT_DATA_HERE"),
)
def sort_table:
   # code here to make request to sort all backend data and fetch a single page
   ...

Hi @spicycactus

Check out this section of the Dash AG Grid docs:

1 Like

Thanks @AnnMarieW, I didn’t know that pagination was on that page! I’d like to keep pagination instead of the infinite scroll so I’ll take a look at those sections. Thank you :slight_smile:

1 Like