I’m trying to update a repeating panel grid once the user edits the information in a row. It gives an alert form, and when the user saves, it sends an event value back to the form that triggers a function to update the repeating panel items. But it’s not working. Here is a GIF that shows the issue.
When the user clicks the edit button inside the repeating panel:
from ...EditCoupon import EditCoupon
from .. import AllCoupons
...
def edit_click(self, **event_args):
"""This method is called when the button is clicked"""
response = anvil.alert(EditCoupon(coupon_id=self.item['id']), buttons=[],large=True)
if response == 'updated':
AllCoupons().populate_coupons()
The relevant form code that is being pop-ed up as an alert:
def save_button_click(self, **event_args):
"""This method is called when the button is clicked"""
response = anvil.server.call('update_coupon',
self.coupon_id_label.text,
self.title.text,
self.status_dropdown.selected_value,
self.short_description.text,
self.long_description.text,
self.category.selected_value,
self.location.text,
self.original_price.text,
self.price.text,
self.restriction.text,
self.image.source,
self.start_date.date,
self.end_date.date,
self.phone.text,
self.address.text,
self.special_instructions.text,
self.coordinates.text
)
if response == 'success':
self.raise_event("x-close-alert", value='updated')
n = Notification('Coupon has been updated succesfully.')
n.show()
else:
n = Notification('Error, please try again later.')
n.show()
The event value is being passed back to the repeating panel template form and the function on AllCoupons
is called:
def populate_coupons(self, **event_args):
self.repeating_panel_1.items = anvil.server.call('populate_coupons')
But as you can see from the GIF, the data on the repeating panel is not being updated. What’s going on?