How do I show a dataTable?

Hi

I have a callback for a data table … and don’t know how show it.

What is the component of the dataTable?

the output is this:

@app.callback(Output('table001','children')

I did a definition for the table

def data_table(drop1,drop2,dff):
    table01 = dash_table.DataTable(
        id='table001',

and returns

table01

to show it here;

dbc.Row(
                            [
                                
                                dbc.Col([
                                    html.H5("Table"),
                                    dbc.Table(id='table001')
                                ],md=12)
                            ],
                            align="center",
                        ),

but doesn’t work, what do I need to change to show the table?

If your callback returns an entire datatable, you could modify the children property of a simple html.Div component.

You can also have callbacks modify components of the table like data, columns, etc.

dbc.Table is a separate component unrelated to DataTable

hi chubakov, good pr;)

you said, if the callback returns the entire datatable… can you be more explicit (don’t understand this).

still can’t manage to show the table …

from dash import Dash, dash_table
import pandas as pd


app = Dash(__name__)

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')

def make_table():
    return dash_table.DataTable(
         data=df.to_dict('records'),
         columns= [{"name": i, "id": i} for i in df.columns]
    )

app.layout = html.Div(id='table_container',children=make_table())

if __name__ == '__main__':
    app.run_server(debug=True)

then you can make a callback that updates ('table_container','children') and takes inputs that you can pass to make_table

TypeError: update_table() missing 9 required positional arguments: ‘drop1’, ‘drop2’, ‘drop3’, ‘drop4’, ‘drop5’, ‘drop6’, ‘drop7’, ‘drop8’, and ‘drop9’

what can I do with this? (its in the layout)