Skip to content

Property value of dash_core_components.Input is not set by callbacks #658

@sinsemellan

Description

@sinsemellan

In the following example, the value of the input textbox in the browser page does get updated by the callback update_a_value. I would expect, that the value is set to 'Set by callback' after the page loaded. The http requests are made correctly as shown in the image, but the new value is not rendered...

import dash
import json
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    dcc.Input(id='a', type='text', value='Initial value'),
    html.Button('Hello', id='button-1')
])


@app.callback(Output('a', 'value'), [Input('button-1', 'n_clicks')])
def update_a_value(unused_clicks):
    return 'Set by callback'


app.run_server(host='0.0.0.0', port=8080, debug=False)

grafik

Versions:

dash-core-components==0.44.0
dash-html-components==0.14.0
dash-renderer==0.20.0
dash==0.39.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions