I’m trying to raise a custom event on the row template of a data grid (datagridEvents with the repeating panel called repeating_panel_Events, on the form frmEventEdit). The event handler is on the parent form (frmEventEdit) and the event handler is set in the form’s init.
The row template has the code to raise the event and execution definitely reaches this point. I had an alert on the line before the raise event line and the alert was displayed. You will also see, in the first code snippet, that I have tried raising the event on self, self.parent and self.parent.parent just to cover all possibilities.
The event handler definitely does not run as the alert in its first line does not display.
The last time I had this problem Jay H pointed out a typo in the name of the custom event. As far as I can tell this is not an issue this time but I wouldn’t be surprised if it is
Code Sample:
ed = self.item['eventdate']
et = self.item['eventtitle']
ad = self.item['addeddate']
rtd = app_tables.signups.search(eventdate=ed, eventtitle=et, addeddate=ad)
if rtd is None:
alert('Cannot find that event!')
else:
#rtd.delete()
alert('About to raise event')
self.parent.raise_event('x-event-deleted', **event_args)
self.parent.parent.raise_event('x-event-deleted', **event_args)
self.raise_event('x-event-deleted', **event_args)
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
self.repeating_panel_Events.items = app_tables.signups.search(tables.order_by('eventdate'))
self.set_event_handler('x-event-deleted', self.RefreshEvents)
def RefreshEvents(self, **eventargs):
alert('Event deletion detected.')
self.repeating_panel_Events.items = app_tables.signups.search(tables.order_by('eventdate'))
Clone link: