@AnnMarieW thank you so much!
I just tried it, it works, only the cell kind of cut-off
and i read all data from an excel file, so i overwritten the unit
for row_index in range(len(df.Unit.values)):
if df.Unit.values[row_index] == 'g/e3m3':
df.loc[row_index, 'Unit'] = 'kg/10<sup>3</sup>m<sup>3</sup>'
html.Div([
dash_table.DataTable(
id='voc_table',
css=[dict(selector="p", rule="margin: 0px;",)],
data=df.to_dict('records'),
columns=[
{"name": i, "id": i, "deletable": False, "selectable": True, }
if i == "CAC" or i == "Fuel" or i == "Source"
else (
# {"name": i, "id": i, "deletable": True, "selectable": True,'type':'numeric', 'format': {'specifier': '.3e'} }
{"name": i, "id": i, "deletable": True, "selectable": True, 'presentation': 'markdown'}
if i == "Unit"
else {"name": i, "id": i, "deletable": True, "selectable": True}
)
for i in df.columns
],
markdown_options={"html": True},
tooltip_duration = 2000,
style_data_conditional=[
],
editable=False, # not allow to edit data of all cells
sort_action="native",
sort_mode='single', # sort by a single column
row_deletable=False, # choose if user can delete a row (True) or not (False)
page_action="native", # all data is passed to the table up-front or not ('none')
page_current=0, # page number that user is on
page_size=20, # number of rows visible per page
filter_action="native",
filter_options={"case": "insensitive"}, # insensitive case when use filter to search
fill_width=True,
style_cell={'textAlign': 'left','minHeight':'100%'},
style_table={'minWidth': '100%', 'justify-content': 'center'},
style_data={ # overflow cells' content into multiple lines
'whiteSpace': 'normal',
'height': 'auto',
'font_family': 'roboto',
'size': '20px',
'color': 'black',
},
style_header={
'backgroundColor': 'white',
# 'fontWeight': 'bold'
'font_family': 'roboto',
'size': '19px',
'color': 'black',
},
),
], # style={'height': 750, 'overflowY': 'hidden','overflowX': 'hidden'}
style={'height': '800', 'width': 'twelve columns'},
className="row-cols-datatable"
),