Skip to content

[BUG] Data table tooltips position is wrong when combined with sorting #3404

@riaanbooysen

Description

@riaanbooysen
dash                 3.2.0
plotly                6.3.0

When using a data table with tooltips assigned, tooltips display at the correct position when native sorting is ascending, but when sorting is set to descending, the tooltips pop up in their old position usually off screen while the data is reversed.

import dash
from dash.dependencies import Input, Output, State
from dash import dcc, html
from dash import dash_table as dt

app = dash.Dash(__name__,
                suppress_callback_exceptions=True)

tooltips = [
    {'a': {
        'type': 'markdown',
        'value': '| x | y |\n| :--- | :--- |\n' + '\n'.join([f'| {n} | {n} |' for i in range(10)]) + '\n|   |   |\n',
    }} for n in range(100)
]
app.layout = html.Div([
    html.Div(dt.DataTable(
        id='datatable',
        columns=[
            {'name': 'a', 'id': 'a'},
            {'name': 'b', 'id': 'b'},
        ],
        data=[{'id': i, 'a': i, 'b': i*2}
              for i in range(100)],
        tooltip_data=tooltips,
        sort_action='native',
    ), id='datatable-div'),
])

    
if __name__ == '__main__':
    app.run(debug=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclebugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions