Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

callbacks aren’t fired if generated content contains only outputs #44

Closed
chriddyp opened this issue Jan 25, 2018 · 0 comments
Closed
Labels
Type: Bug Something isn't working as intended

Comments

@chriddyp
Copy link
Member

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt

app = dash.Dash()
app.config['suppress_callback_exceptions'] = True

app.layout = html.Div([
        dcc.Dropdown(
            id='outer-controls',
            options=[{'label': i, 'value': i} for i in ['a', 'b']],
            value='a'
        ),
        dcc.RadioItems(
            options=[{'label': 'Tab 1', 'value': 1},
                  {'label': 'Tab 2', 'value': 2}],
            value=1,
            id='tabs',
        ),
        html.Div(id='tab-output')
    ])


@app.callback(Output('tab-output', 'children'), [Input('tabs', 'value')])
def display_content(value):
    return html.Div([
        html.Div(id='tab-{}-output'.format(value))
    ])


for tab in ['1', '2']:
    app.callback(
        Output('tab-{}-output'.format(tab), 'children'),
        [Input('outer-controls', 'value')]
    )(lambda value: 'You have selected "{}"'.format(value))




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

chriddyp added a commit that referenced this issue Jan 25, 2018
@chriddyp chriddyp mentioned this issue Jan 25, 2018
@chriddyp chriddyp added the Type: Bug Something isn't working as intended label Jan 25, 2018
chriddyp added a commit that referenced this issue Feb 1, 2018
chriddyp added a commit that referenced this issue Feb 2, 2018
Akronix pushed a commit to Grasia/dash-renderer that referenced this issue Mar 6, 2018
Akronix pushed a commit to Grasia/dash-renderer that referenced this issue Mar 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

1 participant