# Data Table on callback

**URL:** https://community.plotly.com/t/data-table-on-callback/21686
**Category:** Dash Python
**Created:** [April 1, 2019, 5:46am UTC](https://community.plotly.com/t/data-table-on-callback/21686 "2019-04-01T05:46:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![juhipandey4](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@juhipandey4](https://community.plotly.com/u/juhipandey4)
#### Post date: [April 1, 2019, 5:46am UTC](https://community.plotly.com/t/data-table-on-callback/21686/1 "2019-04-01T05:46:53Z")

</div>

Hi All,

I am using dash\_table to upload and show the datatable on callback.  
But callback is not displaying table. Plz assist.

html.Div(dt1.DataTable(data=[{}], id=‘dftable’))

@app.callback(Output(‘dftable’, ‘data’),  
[Input(‘upload-data’, ‘contents’),  
Input(‘upload-data’, ‘filename’)])  
def update\_output(contents, filename):  
df1 = parse\_contents(contents, filename)  
return df1.to\_dict(‘rows’)

Thanks

---

<div class="post-metadata">

### Author: ![juhipandey4](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@juhipandey4](https://community.plotly.com/u/juhipandey4)
#### Post date: [April 1, 2019, 5:48am UTC](https://community.plotly.com/t/data-table-on-callback/21686/2 "2019-04-01T05:48:32Z")

</div>

Plz assist @chriddyp

---

<div class="post-metadata">

### Author: ![Marc-Andre](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@Marc-Andre](https://community.plotly.com/u/Marc-Andre)
#### Post date: [April 1, 2019, 2:14pm UTC](https://community.plotly.com/t/data-table-on-callback/21686/3 "2019-04-01T14:14:11Z")

</div>

@juhipandey4 Providing the `data` prop is not enough to make the table display content. It also needs to be provided the `columns` prop to know which fields to display on each row.

For example, a minimal columns configuration:

```auto
# -*- coding: utf-8 -*-
import dash
from dash_table import DataTable

import pandas as pd

url = 'https://github.com/plotly/datasets/raw/master/26k-consumer-complaints.csv'

rawDf = pd.read_csv(url)
df = rawDf.to_dict("rows"),

columns=[{"name": i, "id": i} for i in rawDf.columns]

app = dash.Dash()
app.scripts.config.serve_locally = True

app.layout = DataTable(
    id='datatable',
    data=rawDf[0:10].to_dict("rows"),
    columns=columns
)

if __name__ == " __main__":
    app.run_server(port=8053)

```
