# Dropdown update datatable

**URL:** <https://community.plotly.com/t/dropdown-update-datatable/10978>\
**Category:** Dash Python\
**Created:** [June 17, 2018, 8:03pm UTC](https://community.plotly.com/t/dropdown-update-datatable/10978 "2018-06-17T20:03:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@Vince](https://community.plotly.com/u/Vince)\
**Post date:** [June 17, 2018, 8:03pm UTC](https://community.plotly.com/t/dropdown-update-datatable/10978/1 "2018-06-17T20:03:30Z")

</div>

Hi I want to use a dropdown menu that update the datatable, however I don’t know how to use the callback, here my code:

dataframes = {‘map\_data’: map\_data,  
‘map\_data1’: map\_data1}

def get\_data\_object(user\_selection):  
“”"  
For user selections, return the relevant in-memory data frame.  
“”"  
return dataframes[user\_selection]

html.Div(  
[  
**html.P(‘Choose data table:’),**  
\*\* dcc.Dropdown(\*\*  
\*\* id=‘choose\_table’,\*\*  
\*\* options= [{‘label’: df, ‘value’: df} for df in dataframes],\*\*  
\*\* multi=False,\*\*  
\*\* value=‘map\_data’\*\*  
\*\* )\*\*

```
    ], className = "row"
    )

```

@app.callback(  
Output(‘datatable’, ‘rows’),  
[dash.dependencies.Input(‘filter1’, ‘values’),  
dash.dependencies.Input(‘filter2’, ‘value’),  
dash.dependencies.Input(‘filter3’, ‘value’),  
dash.dependencies.Input(‘choose\_table’, ‘value’)])  
**def update\_selected\_row\_indices(choose\_table,boroughs, doe, crime, obesity):**  
\*\* df = get\_data\_object(user\_selection)\*\*  
\*\* map\_aux = df.to\_dict(‘records’)\*\*  
\*\* #some filter conditions\*\*  
\*\* rows = map\_aux.to\_dict(‘records’)#get\_data\_object.to\_dict(‘records’)#\*\*  
\*\* return rows\*\*  
Unfortunatly nothing displays, I see only an empty table.

Could someone help me , please.  
Thanks in advance.
