Hi guys!
I want to test the potentiality of using client side functions. Firstly, I’ve tried to run an example from documentation.
Here is my app (clientside_0_simple.py):
import dash
print(dash.version)from dash.dependencies import Input, Output, State, ClientsideFunction
import dash_core_components as dcc
import dash_html_components as htmlapp = dash.Dash(name)
app.layout = html.Div([
dcc.Input(id=‘input’, value=‘hello world’),
html.Div(id=‘output-clientside’),
html.Div(id=‘output-serverside’)
])@app.callback(
Output(‘output-serverside’, ‘children’),
[Input(‘input’, ‘value’)])
def update_output(value):
return ‘Server says “{}”’.format(value)app.clientside_callback(
output = Output(‘output-clientside’, ‘children’),
inputs = [Input(‘input’, ‘value’)],
clientside_function=ClientsideFunction(
namespace=‘clientside’,
function_name=‘display’
)
)if name == ‘main’:
app.run_server(debug = True, host = ‘0.0.0.0’, port = 8092)
And assets/clientside.js:
window.clientside = {
display: function (value) { return 'Client says "' + value + '"'; },
}
However, this doesn’t work. The second DIv (output-serverside) is shown properly, but the first one doesn’t appear. I think this should be an extremely simple issue, but I can’t reach a solution.
Thanks you very much in advance.