What I’m trying to do:
I can not get events to work. This is a very small program with little code, and it is almost the data grid tutorial, except that it gets data from uplink behind our firewall.
When I delete a row it is supposed to remove it from the list. For now I put a refresh-button on top.
What I’ve tried and what’s not working:
I tried to do exactly as in the tutorial, creating an event in main form’s init, and calling it from delete key in subform in the repeating panel.
Code Sample:
# The main for is urlmapper:
class urlmapper(urlmapperTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
self.refresh()
self.urlmapper_repeting_panel.set_event_handler('x-refresh', self.refresh())
# in the subform:
def delete_button_click(self, **event_args):
if confirm("Are you sure you want to delete this: {} ?".format(self.item['beskrivelse'])):
anvil.server.call('delete_url',self.item['URLID'])
self.parent.raise_event('x-refresh')
Clone link:
I include a clone, but you can not run it with connection to uplink. The uplink is serving live data. But there is so few lines of code. I hope someone can tell me what I have missed.
https://anvil.works/build#clone:DJGC6NDDLZISVZAQ=HGW4NI3BR76MTMELPJXQSNBV