I am creating a dashboard with multiple tabs and each tab triggers and .py file that renders different elements of plotly objects.
Link to stackoverflow - SO - Rendering datatable question
For instance, my callback functions return plots, charts and I am looking to return Datatable.
Sample code:
layout = html.Div([
html.Div([
dcc.Dropdown(
id='select',
options=[{'label': i, 'value': i} for i in List],
value='abc',
placeholder="xyz",
style={'width': '100%'}
),
], style={"width": "15%", "margin-left": "20%", "margin-right": "35%"}),
html.Div([
dash_table.DataTable(
id='my-table',
columns=[{"name": i, "id": i} for i in df_lease.columns],
)
])
])
@app.callback(Output('my-table', 'data'),
[
Input("landlord-select", "value")
]
)
def render_table(company, market):
df_sub1 = df_lease[(df_lease['Landlord'] == company)]
df_sub1 = df_sub1[['UnitNo',
'Commencement_Date',
'Expiration_Date'
]]
return df_sub1.to_dict(orient='records')
My question is, how can I accomplish this with Datatable. In this code, I am using import plotly.graph_objs as go
to return graph objects. How would one go about doing something similar for returning datatable.
Note: I am able to do this go.Table as shown in the example, but DataTable is newer and offers an enhanced user experience.
Any help/pointers would be much appreciated.