eddyojb
November 28, 2022, 10:16am
1
Hi,
Is there scope to include callbacks for components such as dropdown menus to trigger callbacks that update another component, such as a plot?
If this is solved I feel it will solve an enormous business problem across the industry.
This is solved with Dash but Anvil makes the UI section of work on an app more inclusive in a team so I would love to be able to use Anvil instead.
Ed
ryan
November 28, 2022, 6:08pm
2
Hello @eddyojb ,
Do you mean this kind of callback?
Part 3. Basic Callbacks | Dash for Python Documentation | Plotly
If so, here’s a very simple version created with Anvil:
https://anvil.works/build#clone:4ESQOB6JGWLCC5XB=JBYDIYETBBSDXMADF56QDLL5
Anvil components can raise events. Here are the Events available for the DropDown component:
When an event is raised it will run the associated Python method. In the function you can update or create components:
def drop_down_1_change(self, **event_args):
"""This method is called when an item is selected"""
self.label_3.text = self.drop_down_1.selected_value
Thanks,
Ryan
1 Like
@ryan , when i clone this and run it, if i make ‘Selection A’ my initial selection it doesn’t populate the label ( it does for Selection B & C ). I added a placeholder and that seemed to work. Not sure why this didn’t seem to work for Selection A ?