I’m using a datatable, and it works beautifully. I’ve set it up so one is presented with checkboxes to select the columns to display. The column titles are of variable length. I’ve set a minimum length and no maximum length. When a column with a slightly longer name is selected, it renders the sort button, and within the same header cell, a new line an then the column title. Which throws things off, some cells have the column name and the sort button on the same line within the cell, some have it across two lines.
Is there a way to force the select button and column title to appear on the same line in the same header cell? The code that I’m using to generate the table is as follows:
def generate_table(dataframe, selectedColumns, max_rows=10):
return dash_table.DataTable(
id='datatable-interactivity',
columns=[
{"name": i, "id": i, "deletable": False, "selectable": True} for i in selectedColumns
],
data=dataframe.to_dict('records'),
editable=False,
filter_action="native",
sort_action="native",
sort_mode="multi",
#column_selectable="single",
#row_selectable="multi",
row_deletable=True,
selected_columns=[],
selected_rows=[],
page_action="native",
page_current= 0,
page_size= 20,
style_as_list_view=True,
style_table={'overflowX': 'scroll'},
style_header={
'backgroundColor': 'white',
'fontWeight': 'bold'
},
style_cell={
'minWidth': '140px' ,
'whiteSpace': 'normal',
'font_size': '18px',
'text_align': 'left'
}
)
i.e it’s doing this: