Skip to content

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

Closed

Description

@CNFeffery

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)

Activity

  1. T4rk1n commented on Jun 7, 2024

    @T4rk1n
    Contributor

    The new fields can be added here:

    dc.callback_context.states = stateDict;

    The data is available in payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions