How do you bind a repeat row to a datastore? This driving me nuts!

I have a repeat and it creates rows when you click a button by adding a record in a DataStore and counting the records. this row has an empty text field - all works fine.


I also need for each of those rows in the repeat to hold their id record in the DataStore so that when I update or delete a row in any order I can pass the ‘id’ to the the data-store for that repeat row.

How on earth do you do this? I have used $index as the row 'id 'but that is not ideal as it relies on the page not being refreshed. I need a variable for each row created to store the row ‘id’ that is submitted to the Datastore, so I can then pick it when I need to to do a row update or insert.

I also need the row id so that I can add in a child repeat which references the parent repeat.

Non of this is connected to the database it is dynamically created in the front end to collect data and update a datastore.

But can not figure out how to do this?

Any help on how to do this?

This may help

Thank @ben!

Unfortunately this only works if you are first pulling data from a database and you have something to tie the two together.

In my case I am using a repeat to create form rows which can then save data to the Data Store. So I have to find a way of linking the rows which are dynamically created to the rows added to the Data Store as the are created.

Basically creating a form that looks like below and then adding values to them to save to the data store.

But I am completely out of my depth with Wappler now and no idea where to go from here.

In the datastore records have a $id to identify them.