We want to be able to refresh the table at any time, so we can show the user what happens when they create or update rows.

Here’s the line we’ve been using to fetch the inventory items from the database:

    self.repeating_panel_1.items = anvil.server.call('get_items')

Remove this line from __init__ and put it in a method of its own:

  def refresh(self, **event_args):
    self.repeating_panel_inventory.items = anvil.server.call('get_items')

Now call your new method from __init__:

  def __init__(self, **properties):
    # Set Form properties and Data Bindings.

    # Any code you write here will run when the form opens.

Let’s also create an event to trigger a refresh. That makes it easier to trigger a refresh from outside this Form.

At the end of __init__, add the following line to bind an event that triggers a refresh:

    # At the end of __init__:
    self.set_event_handler('x-refresh', self.refresh)

Re-run your app: you should still see your database rows displayed in the table.