I have created a dash app in which I am displaying a few tables.
I cannot find how to allow the user to sort the table based on a value. I didn't find anyhting useful on their documentation.
Can I create a custom function where a user can select a column and I can display the data sorted according to that column?
Here's my code for my table:
basic_max_3=go.Figure(data=[go.Table(
columnwidth=[80, 400,80],
header=dict(values=list(
['col_1', 'col_2','col_3', 'col_4']),
fill_color=px.colors.qualitative.Pastel2[6],
align='left'),
cells=dict(
values=[df['col_1'], df['col_2'],df['col_3'], df['col_4']],
fill_color=px.colors.qualitative.Pastel1[8],
align='left',height=70))], layout=layout_max)
You can use the updatemenu method to modify the data of the table.
I.e. the data frame is sorted according to the selected column and the data in the cells of the table is replaced with this sorted data (see also the intro to dropdowns).