How to use "dropdown_data" in DataTable

Can someone please explain to me how the dropdown_data property works. Can I add a dropdowns on specific rows with this?
If I do:

dropdown_data=[{ 
            'climate': {           
                'options': [
                    {'label': i, 'value': i}
                    for i in df['climate'].unique()
                ],
            }
}]

I get a dropdown on the first row only, under the climate column.

Can I use “dropdown_data” to insert dropdowns on any row I’d like? let’s say, the 2nd and 4th row only, instead of the 1st. Am I using this correctly?

You’ll need to use dropdown_conditional, see the second example: https://dash.plot.ly/datatable/dropdowns

Hi @chriddyp
Thank you for the reply. I actually know how to use dropdown_conditional, but I am not sure about dropdown_data. What is dropdown_data that used for? I have read the documentation but was not clear on it, and could not find an example of it being used anywhere on the internet or on this forum.

Ah OK, sorry I read this too quick. Yes, I believe dropdown_data has the same shape as data and provides the options. So, your list needs to have multiple dictionaries where each dictionary is a new row (and the keys of the dictionary are the column IDs)

1 Like