✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

DataTable page_count always returns None

There seems to currently be an Issue in the Datatables where if for example:

User is in page 50 and then filters but there are now only 20 pages the user will remain at page 50 (which is now blank).

I have tried to get around this by using the filter_query to trigger a callback if page_count < page_current then set the current page to page_count.

@app.callback(
    [
        Output("calc_data_summary", "page_current"),
    ],
    [
        Input("calc_data_summary", "filter_query")
    ],
    [
        State("calc_data_summary", "page_count"),
        State("calc_data_summary", "page_current"),
    ],
)

def reset_filter_sort_on_datatable(filter, total_pages, current):
    if total_pages is None or current_page is None:
        return [1]


    if total_pages < current_page:
        return [total_pages]

    return [current_page]

However, I found that this code was never running. When I investigated I found that page_count was always returning None and therefore never got past the first if statement.

The documentation (https://dash.plot.ly/datatable/reference) says that

`page_count`  ( *number* ; optional):  `page_count`  represents 
the number of the pages in the paginated table.

I assumed this to mean that it should return the value of the total amount of pages.

Do I have this correct?

However, I have noticed that