Hi all, i’m wondering if anyone can help. I need to figure out how users can reorder their images within a RG, the images are a list or urls within “property” data, there are no data sets attached the the images therefore i cant do the typical drag & drop sort order and alter a number up or down etc.
I tried custom states but cant get anything to work so far. I just want for users to drag and reorder the images based on order preference but i’m super stuck, has anyone managed to solve this before? ive searched the forum and searched youtube etc and havent found the exact issue.
Are you effectively keeping the reference to the images in memory rather than in the database?
If it is the former, what you could do is append a sort order to the file name and use a separator to split the sort order from the file. Then implement your drag and drop by splitting out and renaming the file/sort order. (Hacky)
If it is the latter, add a sort order to your database and then take it from there.
Hi @zoeforster87 - This is achievable but it’s not that straightforward.
Let’s say you have 2 arrows in your group to move the position of the current image. If someone clicks on the right arrow, you will want to make changes to "property" where you re-set the list of Urls.
Then you use an expression like: Repeatinggroup's URLs items until: current cell's index + 1 (you will probably need an extra group in your cell to get the next and prev. index): minus item: current cell's URL:plus item: current cell's URL: merged with Repeatinggroep URLs list of Urls.
Basically what we do is: We take the list up to the next url, then remove the current url and add it back after the last URL (index+1), then we add the remaining urls from the RG.
Im not keeping any order record of the images within the database, its just a list of texts (imageurls) attached to a property within the database. Im not sure how to work around it as the images all feed out to other websites with api etc and if i start messing around it could really mess everything up.
Oh I think this could work thank you, i will give it a try. Its a little hard for my brain to comprehend atm but i think this is definitely the best solution, thank you
I don’t really understand why (because I can’t see the details) where you can’t attach a sort order to the image reference? They are, after all, just references you are storing to things you get from an external API.
But I guess you have that knowledge and will be in the best place to understand how it all hangs together.