How would you enable a tab by using callouts? As an example below, I have two tabs where the second one ‘tab-2’ is disabled.
from dash import Dash, DiskcacheManager, CeleryManager, dcc, html,no_update, ctx, dash_table
from dash.dependencies import Input, Output, State
app.layout = html.Div([
dcc.Tabs(id="tabs-styled-with-inline", parent_className='custom-tabs',value='tab-1', children=[
dcc.Tab(label='Class Stats',
value='tab-1',
style=tab_style,
selected_style=tab_selected_style,
disabled=False,
children=[something_layout]),
dcc.Tab(label='Class Analysis',
value='tab-2',
style=tab_style,
selected_style=tab_selected_style,
disabled=True,
children=[something_layout2]),
], colors={
"background": "#434343"
},style=tabs_styles),
html.Div(id='tabs-content-inline'),
dcc.Store(id='current-data'),
],
)
I thought it would be something like this below:
@app.callback(
Output("tab-2", "disabled"),
Input('current-data', 'data'),
)
def enable_tab(current_df):
return False
But I am not getting anywhere with it. I believe it has to do something with the tabs ID being “tabs-styled-with-inline” and I have to maybe specify that the tab-2 is part of that ID. Could someone show me how this works?
For clarification, the enable_tab
function should be triggered whenever the current-data
gets populated or refreshed…I’ve added it as a dcc.Store element in the example above.