Sorry it’s a bit long.
I have defined dash_table.DataTable
inside Div
app.layout = html.Div(
children=[
dash_table.DataTable(
id="datatable-Rates",
columns=[
dict(id=i, name=j, editable=m, type=l, format=k)
for i, j, k, l, m in zip(
Rat_columns[::-1], Rat_names[::-1], Rat_formats[::-1], Rat_types[::-1], Rat_editable[::-1]
)
],
data=Rates.to_dict("records"),
sort_action="native",
selected_rows=[],
sort_mode="single",
style_cell={
"minWidth": 35,
"width": 370,
},
fill_width=False,
style_cell_conditional=[ # align text columns to left. By default they are aligned to right
{"if": {"column_id": c}, "textAlign": "center"} for c in Rates.columns
],
style_data_conditional=[ # 125, 181, 178
{"if": {"column_editable": False}, "backgroundColor": "rgb(125, 180, 200)", "color": "white"}
],
style_data={
"whiteSpace": "normal",
"height": "auto",
"border": "none",
"border-bottom": "1px solid #ccc",
}, # overflow cells' content into multiple lines
style_header={"backgroundColor": "rgb(30, 30, 30)", "color": "white"},
),
],
I tried to put the DataTable
in a html.Tbody
and used dir='rtl'
but it messed up every thing.