Table Error while adding new row to data table

please help me with this error
TableError: This row has been deleted
while setting self.check_box_1.checked = self.item[‘done’]
in a data binding for self.check_box_1

Welcome to the forum @santosh!

I guess you’re following the Storing and Displaying Data Tutorial, in which case there’s a slight error in it that occurs if you add an item after you’ve deleted an item.

The self.remove_from_parent() in ItemTemplate1 removes the component from the Repeating Panel, but it does not remove the client-side representation of the database row from self.repeating_panel_1.items .

So the list(self.repeating_panel_1.items) contains the row that was deleted:

  l = list(self.repeating_panel_1.items) + [new_row]
  self.repeating_panel_1.items = l

A solution is to re-load the repeating panel based on the database contents. So those lines should be replaced with

    self.repeating_panel_1.items = app_tables.reminders.search()

This is fixed in the example app that you get if you click the ‘Edit This App’ button under the video.

https://anvil.works/ide#clone:VJKFMQNS35KFXMXQ=JYGPIPIGRAIK43J5YNBRWURE

2 Likes

thanks a lot for your help Shaun, I was just trying to figure this out.