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

Current_table showing an output based on first page of the table

Hi!

I have a dashtable with different pages (pagination = True) because it has over 5000 records, and the page loads very slowly when I use, for example, page_size=5000. I made a def that returns the contents of the row when clicked with more details from the sqlite database I’m using.

Here is the base code:

@app.callback(
    Output('popup-container', 'children'),
    [Input('table', 'selected_cells'),
     Input('table', 'derived_virtual_data'),
     Input('my-dropdown', 'value'),
     ],
)
def update_popup(sel, current_table, value):
    if sel:
        column_name = sel[0]['column_id']
        row_num = sel[0]['row']
        valor = current_table[row_num][column_name]
        print(valor)
        print(current_table)

Where ‘popup-container’ is a Div, ‘table’ is the dashTable and ‘my-dropdown’ is a dropdown that doesn’t interfere. Sel is a variable that gets the selected_cell row.

This def is working fine for the first page of the dashtable. However, when I change pages the current_table variable returns only the first page of the table. How can I make the current_table return the current page data?

Solved! I used ‘derived_viewport_data’ instead of ‘derived_virtual_data’ and it worked fine!