This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
Tooltip position is incorrect after sorting/filtering data table #872
Open
Description
Tooltips get messed up after sorting or filtering. Simple reproducible example below.
import dash
import dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/curran/data/gh-pages/Rdatasets/csv/MASS/Animals.csv')
df.columns = ["Animal", "body", "brain"]
def create_tooltip(cell):
num = len(cell)
if num > 7:
return(cell)
else:
return("")
tooltip_data = [{
column:
{'value': create_tooltip(df.loc[i, column]), 'type': 'markdown'} for column in df.columns if column == "Animal"} for i in range(len(df))]
app = dash.Dash(__name__)
app.layout = dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('records'),
sort_action = "native",
filter_action = 'native',
style_header={'fontWeight': 'bold','border': 'thin lightgrey solid','backgroundColor': 'rgb(100, 100, 100)','color': 'white'},
style_cell={'fontFamily': 'Open Sans','textAlign': 'left','maxWidth': '0px','whiteSpace': 'no-wrap','overflow': 'hidden','textOverflow': 'ellipsis'},
style_table = {'overflowX':'scroll', 'overflowY':'scroll', 'maxHeight':'400px', 'maxWidth':'200px', 'marginLeft':'100px'},
tooltip_data=tooltip_data,
tooltip_delay=0,
tooltip_duration=None
)
if __name__ == '__main__':
app.run_server(debug=True)
Metadata
Metadata
Assignees
Labels
No labels