Situation1, I have two callbacks:
@callback(
Output('hover-data', 'children'),
Input('basic-interactions', 'hoverData'))
def display_hover_data(hoverData):
return str(hoverData)
@callback(
Output('click-data', 'children'),
Input('basic-interactions', 'clickData'))
def display_click_data(clickData):
return json.dumps(clickData, indent=2)
Situation2, I have one callback:
@callback(
Output('hover-data', 'children'),
Input('basic-interactions', 'hoverData'))
def display_hover_data(hoverData):
return str(hoverData)
I rewrite the object Dash
’s method dispatch
:
def write_info(self, info):
file = open('/root/arcta/notebook/comp/exx.txt', 'a')
file.write(f"{info}\n")
file.close()
def dispatch(self):
self.write_info("aa---")
body = flask.request.get_json()
self.write_info(str(body))
self.write_info("bb")
In situation1, when I hover a data or click a data, the method dispatch
will run. But in situation2, when I click a data, the method dispatch
will not run. It seems the macro callback
register a EventLisener
to the code from the webpage. But where is the code that register the EventLisener
to the web? How does it make the post on _dash-update-component
decide that when clicking a data, it will not make a request?