I succeed to implement the drop-down option within the data table without any problem. However, when I click on the options, I can’t display the menu/list of values possible.
Oh, it’s 'presentation'! The docs say 'type'. Thanks!
I wish I could help, but mine worked with this change. My only guess for your error is that the result of df_roster['MISSION'].unique() is not a list of strings, but some numpy type.
I am facing the same issue. Even copying and pasting the example provided in the User Guide is not working- i.e. the drop-down returns an empty list. Was this resolved?
Apparently this solution is not viable again, with the latest updates, and without Dash-bootstrap-components.
It would be nice if official documents would also contain instructions for necessary css components.
The solution ended up working for me. I was making a mistake in where I was placing the css (never worked with this before). Ensure it is not inside any media group but is at the outermost indentation level.
Hi,
I have tried the following & it solves the issue
I am using external_stylesheets=[dbc.themes.FLATLY]
Don’t know if it is a correct solution, but it is ok
dash_table.DataTable(
id='table-dropdown',
data=df.to_dict('records'),
**css=({ 'display' : 'block' }),**
columns=[
{'id': 'climate', 'name': 'climate', 'presentation': 'dropdown'},
{'id': 'temperature', 'name': 'temperature'},
{'id': 'city', 'name': 'city', 'presentation': 'dropdown'},
],
editable=True,
dropdown={
'climate': {
'options': [
{'label': i, 'value': i}
for i in df['climate'].unique()
]
},
'city': {
'options': [
{'label': i, 'value': i}
for i in df['city'].unique()
]
}
}
),
Hi - can you say where to add the CSS-code? When I copy -paste your code python crashes - it doesn’t like the asterisks. It doesn’t work without the asterisks, either - DashTable doesn’t recognize ‘css’ as an argument. I tried saving the code snippet as ‘dashtable.css’ in a folder ‘assets’, as suggested in the dash-manual for adding css-files - but that didn’t make any difference.
I reckon I’m missing some basic dash-knowledge. Eager to learn & to solve the issue.
Hi David,
You should remove the asterisks, I don’t know why it is showing in my post it is a mistake maybe because I wanted to make the line bold that it was added
Can you please share your code if I could help ?
For anyone stumbling into where this doesn’t solve the issue completely (scroll bar displayed in the cell but no options below the table), especially where you only have a few rows of data. Check to make sure that you don’t pass this argument to the data_table.
fixed_rows={'headers': True}
This causes the table to shrink to 100% of the data that is represented, regardless of what arguments you pass in the style.