Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Send "fake" event from client-side js to server

$
0
0

I have dynamic content (HTML) in my python dash application that is not generated by dash, rather from an application server. There are some buttons in the content which I would like to wire to send an event back to dash, as if dash had created the buttons.

I found the typescript function that handles callbacks (handleServerSide()) in dash-renderer/src/actions/callbacks.ts. I also see that a typical button click POST payload looks like:

{
    "output":"<id>.<target>",
    "outputs":{"id":"<id>","property":"<target>"},
    "inputs":[{"id":"<button id>","property":"n_clicks","value":<latest value>}],
    "changedPropIds":["<button id>.n_clicks"]
}

However, as handleServerSide() is munged into some random name, I don’t have a way to call it / attach it to the dynamic buttons. While I could certainly send a POST with the right payload to the server / app, the response (whatever is to be rendered) would not be processed without using this function.

Is there a way to create synthetic events on the client side that flow through this mechanism properly, like Shiny.onInputChange()? It should be fairly straightforward to add, I would think, if I understood how handleServerSide() is called.

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images