# \[Solved\] Unable to dynamically return a datatable

**URL:** <https://community.plotly.com/t/solved-unable-to-dynamically-return-a-datatable/6587>\
**Category:** Dash Python\
**Created:** [October 31, 2017, 4:42pm UTC](https://community.plotly.com/t/solved-unable-to-dynamically-return-a-datatable/6587 "2017-10-31T16:42:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![partybearlj](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@partybearlj](https://community.plotly.com/u/partybearlj)\
**Post date:** [October 31, 2017, 4:42pm UTC](https://community.plotly.com/t/solved-unable-to-dynamically-return-a-datatable/6587/1 "2017-10-31T16:42:13Z")

</div>

I previously had a Datatable and a Graph seperate but since they shared the same stock data I’m trying to combine the two.

When I try and return both a datatable and a graph it comes up blank. If i just return the Graph it appears and just the Datatable once again empty.

Here is some summary code.

app.layout = html.Div([  
**_other stuff_**  
html.Div(id=‘comps-analysis’),  
], className=“container”)

@app.callback(  
dash.dependencies.Output(‘comps-analysis’,‘children’),  
[dash.dependencies.Input(‘stock-ticker-input’, ‘value’),  
dash.dependencies.Input(‘events-select’, ‘values’),  
dash.dependencies.Input(‘index-input’, ‘values’),  
dash.dependencies.Input(‘index-input’, ‘options’),  
])  
def update\_graph(tickers, events, index\_values, index\_options):  
comps\_df = pd.DataFrame(comps)  
**generates the graph and dataframe**  
return html.Div([  
dcc.Graph(  
id=‘comps\_graph’,  
figure={  
‘data’: charts,  
‘layout’: {  
‘margin’: {‘b’: 0, ‘r’: 10, ‘l’: 60, ‘t’: 0},  
‘legend’: {‘x’: 0}  
}  
}  
),  
dte.DataTable(  
rows=comps\_df.to\_dict(‘records’),  
columns=[‘Type’, ‘Company’, ‘High’, ‘Low’, ‘Performance’],  
row\_selectable=True,  
sortable=True,  
selected\_row\_indices=[],  
id=‘comps-table’  
),  
])

Everything works when i keep it seperate but that involves downloading the same data twice.

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [October 31, 2017, 4:45pm UTC](https://community.plotly.com/t/solved-unable-to-dynamically-return-a-datatable/6587/2 "2017-10-31T16:45:38Z")

</div>

See [Comment #40 - Display tables in Dash](https://community.plotly.com/t/display-tables-in-dash/4707/40?u=chriddyp)

---

<div class="post-metadata">

**Author:** ![partybearlj](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@partybearlj](https://community.plotly.com/u/partybearlj)\
**Post date:** [October 31, 2017, 4:50pm UTC](https://community.plotly.com/t/solved-unable-to-dynamically-return-a-datatable/6587/3 "2017-10-31T16:50:44Z")

</div>

Thanks. Dash \> Tableau…
