Hello Dash world,
I’m trying to get the focus set on a dcc.Dropdown at page loading.
I understand it could be done resorting to a clientside_callback (see for example Is there a way to deselect a dash component (i.e. remove focus)?)
However, I’m working in the context of a multipage dash application, where the layout is defined as a function (to deal with url parameters)
As a result, the clientside_callback generates a “my_component is not defined”, as it appears the callback is set before the creation of the component.
Any idea how to circumvent this issue ?
Many thanks
HI @qwertzu,
what exactly is the error you get? Maybe setting
app = dash.Dash(
__name__,
suppress_callback_exceptions=True
)
does help.
Thanks for the fast reaction !
The proposed settings do not solve the issue.
The error I receive is literally :
ReferenceError: my_component is not defined
at ns.style (http://127.0.0.1:8050/:56:29)
at _callee2$ (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:573:74)
at tryCatch (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:409:2404)
at Generator._invoke (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:409:1964)
at Generator.next (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:409:3255)
at asyncGeneratorStep (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:413:103)
at _next (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:414:194)
at http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:414:364
at new Promise (<anonymous>)
at http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_7_0m1672740070.dev.js:414:97