Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request] Add outputs and outputs_list to window.dash_clientside.callback_context #2877

Closed
CNFeffery opened this issue Jun 6, 2024 · 1 comment · Fixed by #2881
Closed
Labels
good first issue suitable for newcomers

Comments

@CNFeffery
Copy link
Contributor

For dash's client-side callbacks, adding outputs and outputs_list for window.dash_clientside.callback_context will improve operational freedom in many scenarios. Currently, only the following information can be obtained in the client-side callbacks:
image

import dash
from dash import html
from dash.dependencies import Input, Output

app = dash.Dash(__name__)

app.layout = html.Div(
    [html.Button("trigger", id="trigger-demo"), html.Pre(id="output-demo")],
    style={"padding": 50},
)

app.clientside_callback(
    """(n_clicks) => {
        return JSON.stringify(Object.keys(window.dash_clientside.callback_context));
    }""",
    Output("output-demo", "children"),
    Input("trigger-demo", "n_clicks"),
    prevent_initial_call=True,
)

if __name__ == '__main__':
    app.run(debug=True)
@T4rk1n T4rk1n added the good first issue suitable for newcomers label Jun 7, 2024
@T4rk1n
Copy link
Contributor

T4rk1n commented Jun 7, 2024

The new fields can be added here:

dc.callback_context.states = stateDict;

The data is available in payload.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
good first issue suitable for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants