Forum Academy Marketplace Showcase Pricing Features

Editing content that is a list of(field) into a list of items(type)

Hi everyone,

I have a question regarding changes in a list of images (field).

When I press the delete icon I can refer to “current cell” which deletes the right picture in the list of images.

But to edit this image using Croppie plugin, when a croppie is saved, my workflow would just add the saved picture at the end of the list (field).

My question would be if it’s possible in any ways to swap the deleted picture (position in the field of previous image) with the croppie one I’m saving after editing it and pressing a save button ( in croppie group)?

Screen Shot 2022-01-31 at 12.17.42 pm

So I created 1 more type list of images with field image 1, image 2, etc…

In my type Item I created field Lists of images to retrieves the type List of images.

I changes the repeating group to 1 group image 1, 1 group image 2, etc…

Let see I’ll continue tomorrow.

Edit: And it becomes messy. I should probably be looking at some javascript code.

It could be possible to swap positions if " created date" was editable but it isn’t.
Therefore you need to change your DB structure.
Instead of the list of images make certain DB with 2 fields.
1 field - image is self
2 field - count ( number type)
Then connect it to whatever you need as a list of images
Now you can make RG with them and sort it by count.
And when you delete a certain cell of the image you can create a workflow to swap counts with each other.

Well it’s basically to have a listing as in Facebook listing in marketplace.

It’s possible to have those orders in the field modified look at this plugin: ↕ [Update Apr 28] - Sortable RG Drag & Drop plugin by EzCode

So I’m using croppie plugin and designed a group where I can crop, flip, whatever then save the result image but it gets messy with the extra type (list of image) I made. It’s working but it’s not what I want, you have number 1 group, then 2, 3,etc… But when deleting image 2, the group 2 even collapsed still takes width and moreover the position 2.

So need to go back where I started with a rg and the list of image included as a field in my items type.

This wasn’t the right plugin, but the ezcode dragNdrop is what I would need. Must be a way to code this :sweat_smile:

I noticed the same thing when the cell is deleted the width keep. That might be a bug. I fixed it by adding conditions.
" When this group’s image is empty"
This is element is visible.

Well as I said it looks too messy. If I want 10 groups for 10 pictures it’s a lot of backed conditions. I just need a rg.

The drag and drop plugin solves one of those feature the listing group would have and highlights the fact that there is a possibility to have some backend code doing something similar but when editing then saving the picture with croppie or other plugins.

Hi @Arzy .

Imagine a list of images:

  • image1.jpeg
  • image2.jpeg
  • image3.jpeg
  • image4.jpeg
  • image5.jpeg

1) What you will have to do is to save the index of the picture you are editing as a custom state (let’s call it “pic_index”). So, if you are editing the image3.jpeg, your custom state pic_index will be 3.

2) Now you will run a workflow to save the first elements of the list in another costum state (list type). Let’s call this custom state “temp_list_1”. So you will record all the elements of the original list UNTIL index 2 (that will be the value of your custom state “pic_index” minus 1).

The temp_list_1 should be “image1.jpeg, image2.jpeg”

  1. You will also have to save the last pasrt of the list in another custom state (list type). Let’s call this custom state “temp_list_2”. So you will record all the elements of the original list FROM index 4 (that will be the value of your custom state “pic_index” plus 1).

The temp_list_2 should be “image4.jpeg, image5.jpeg”

Now, what you have to do is to clear the original list and add all the separeted parts to rebuild it as before. Something like:

  • original_list add tem_list_1
  • original_list add image3.jpeg
  • original_list add temp_list_2
1 Like

Yes definitely custom states help. I’ll try it!

Edit: Ok done much thanks @rpetribu

It works but it seems to have a bug when I have 3 images and edit the last one:

I clear the list, add temp_list-1, the edited image, temp_list_2 is empty. and I have 1 blank image for the 2 first.

Screen Shot 2022-02-02 at 12.00.43 am

Here The workflow:

oohhhh yes… true… make sense!

This is happening because you don’t have the last part of the list. This same behavior should be expected if you edit the first image, because you will not have the first part…

So what you can do to prevent this error is split the “add” to list action in trree separated parts instead of do it all at once as you shared in your image below.

You will add temp_list_1 ONLY WHEN pic_index > 1

Making this restriction you will prevent erros when editing the first image. Because if you are editing the first image, there is no “temp_list_1” to be added…

And you will add temp_list_2 ONLY WHEN pic_index < repeating_group:count

Making this restriction you will prevent erros when editing the last image. Because if you are editing the last image, there is no “temp_list_2” to be added…

Make sense?!

Yes I was going to try that today!


Still having the same issue though. I noticed this error that pops after the action and it’s like the complete list of the 3 first images in 1 URL:

Here the states where I checked the “list” box:
Screen Shot 2022-02-02 at 4.19.34 pm

And here the value I save which seems alright:

My bad, there are “Add” and “Add list”…

I found the issue:

I set a state (number of images) when I press edit button and that’s it!

Thank you for the help @rpetribu!