Is it possible to manage a list of things in a repeating groups although these things don’t exist in the database yet ?
I want to let my uses create/modify/delete items in a group in the front end without making useless calls to the backend until they click the ‘save’ button that will actually make the change to the entire list.
I tried to play with custom states and plugins like JSON creator and Orchestrator but this is all really hacky and I’m wondering if you guys came up with better ways to do this ?
I’ve tested some free ones at some point in the past, basically there’s not much difference between what the free options do. You may want to “play” with them. But I believe it would be worth checking Floppy (by Keith), it would probably be one of the best options.
Yes it can. Text, numbers, dates, addresses are all things that can be a custom state value and they don’t need to exist in the database to be used in a custom state as I am quite certain.
Thanks for the tip, however when using a list of texts, I don’t think we can easily update one of these ‘pseudo-objects’ from within the list, before we save it as data? Or have you already done this? How?
Yes I do it all the time when I don’t want to make changes to the database until the final save button is clicked.
You just need to make sure there is only 1 text in the list for each database item - so if you modify one, you need to replace it with the updated version.
Thanks, how to you recognise the text that’s been modified since the new pseudo-object is now a different text ?
Do you keep a before/now version of the pseudo-object?
I create 2 custom_states of the same type as the database table: created_items and deleted_items.
My repeating_group returns the database list ‘merged’ ‘created_items’ minus_list ‘deleted_items’.
And everything the user does before clicking the save button only changes these custom states.
If he creates a record, I save it in the database, but also in the custom_state ‘created_items’, because if he doesn’t save it, I will have the list that I must delete.
If he closes the screen without saving, I simply delete the ‘created_items’ records and that’s it.
If it saves, then I go to the database and delete the ‘deleted_items’ from the table and add the ‘created_items’ to the table.