Data Bindings to simple Object dictionary or list

The key for Save/Cancel is to use a temporary list in place of the real one. That way, if the user Cancels, the original remains unchanged.

  1. from copy import deepcopy
  2. Create the temporary list: self.edit_buffer = deepcopy(self.item['location_details']['sites'])
  3. bind the Repeating Panel’s enclosing Data Grid (not the Repeating Panel!) to the copy, i.e., to self.edit_buffer.
  4. Bind each of the Grid’s columns to its corresponding dict entry, by name (key). For example: image
    So your Keys would be site_name, address_1, etc.
  5. At run-time, the Data Grid will bind each instance of the Repeating Panel to its own list element for you, so you should not bind the Panel itself.
  6. Within the Repeating Panel, bind each editable field to its value by name (key): item[ key ] For example:image
  7. On Save, re-assign so['sites'] = self.item['location_details']['sites'] , and write it back to the database.
  8. On Cancel, leave self.item['location_details']['sites'] unchanged.

I hope this clarifies matters!