Hello,
I noticed on my Dash Data tables, that headers for the table suddenly stopped respecting the style_header ‘text-align’: ‘center’ instruction when running under Dash v2.1.0. I’m maintaining a dashboard that runs under Docker and the command to install Dash was unversioned, so it always loaded the latest version. After debugging, I backed down to Dash v2.0.0 and it resolved the issue. Here is a bit of code that can be used to see this:
import dash
from dash import dash_table
import pandas as pd
app = dash.Dash(
__name__
)
app.layout = dash_table.DataTable(
columns=[
{"name": ["", "Year"], "id": "year"},
{"name": ["City", "Montreal"], "id": "montreal"},
{"name": ["City", "Toronto"], "id": "toronto"},
{"name": ["City", "Ottawa"], "id": "ottawa"},
{"name": ["City", "Vancouver"], "id": "vancouver"},
{"name": ["Climate", "Temperature"], "id": "temp"},
{"name": ["Climate", "Humidity"], "id": "humidity"},
],
data=[
{
"year": i,
"montreal": i * 10,
"toronto": i * 100,
"ottawa": i * -1,
"vancouver": i * -10,
"temp": i * -100,
"humidity": i * 5,
}
for i in range(10)
],
style_header={
'text-align': 'center',
},
merge_duplicate_headers=True,
)
if __name__ == '__main__':
app.run_server(debug=True)
This code will center the headings for the table in version 2.0.0, but will suddenly push every header to be right aligned under Dash version 2.1.0. My current solution is to simply force the use of Dash v 2.0.0, but I notice slightly slower load times. Not a serious problem, but I thought you would like to know about this issue.