Is it possible to use a repeater to manage a data collection? I created a repeater with user inputs, corresponding to managed fields, and set it connected to a read-write datasource. I also added a ‘delete’ button to a repeater item and set it to a dataset function delete. I linked a dataset ‘save’ function to every user input .onKeypress() event in case of text input or .onChange() event in case of a dropdown. I added a separate ‘New’ button outside the repeater to create a new row.
What’s working:
— The repeater reflects all the data
— The delete buttons work for every row
What’s not working:
— On ‘New’ button press the repeater refreshes the list and show the new empty row, however, the row is being added in a random order
— Data is being updated every second time. I tried to create an additional ‘submit’ button, with the same result.
Is it a bug, or I shouldn’t use the repeater this way? Thanks.
This example might help:
Input Components in Repeater
Use input components in a repeater, and apply inline and global actions to repeater content.
@Yisrael, thank you for the example. It’s exactly what I’m trying to build. However, the code in the example doesn’t work as expected in the preview mode. Should I test it with the live database only?
@Yisrael, it’s my fault. I forgot to save the example site, and it was in the template mode. Everything works. sorry. Thank you!
@yisrael-wix , sorry again, but not everything works. The ‘Global actions’ page works perfectly, however, the ‘Inline actions’ page has several errors and problems:
— On new record adding or item saving an error ‘Unhandled promise rejection DatasetError: Parameter (fromIndex) must be a number’ appears.
— New record appears in the middle of the list.
— ‘Add new’ button is disabled every second time after you edit freshly added record changing the dropdown only.