Home Forums Feature Requests Repeater field : duplicate row


Repeater field : duplicate row

  • Hello,

    First, thanks for such a great plugin. It saves my day on every projects.

    But a little enhancement would be great. On a post edit form, in a repeater row, it would be great to have a button “duplicate” to add a new row with fields filled with datas from the duplicated row. And then simply edit values to change.

    For example : I use a repeater field with 10 inputs. The first row, I fill the 10 fields. And I want to add a row with almost the same values except 1 field. I have to “Add a row”, and fill (or copy / paste) datas in the new field, 9 times. With the “duplicate” button, I only have to edit 1 value.

  • I’ll mark this for the developer to take a look at when he has time.

    I would say to look at this,

    I actually thought about trying my hand at this, but it would not be a simple thing. Once I started thinking about everything that it would needed to do this it’s became something that I would not to maintain. Especially since I’m not that familiar with the JavaScript side of ACF.

    I think that copying something like text fields could be simple, however, if this was something that was added to ACF, or and add on that another developer created, it would be far more complicated. Once you add duplicating text fields then someone will want to be able to do the duplication no matter what type of sub fields are in the repeater, including nested repeaters or even flexible content fields. Then once that’s done someone will want to do the same thing with flexible content fields.

  • +1
    And I would love this feature for Flexible Content too.

  • +1
    (for flexible content items as well)

  • +1 from me too! Awesome idea!

  • BIGGEST +1 from me here. I have messed about for short amounts of time trying to build this feature myself, but haven’t gotten around to it completely.

  • I’ve actually looked at it a couple of times. On of the complex parts for me is where to put the button and what icon to use. I keep hitting a brick wall here because there really isn’t anywhere to put it. Over on the right you have the + and – buttons and these just barely fit on a collapsed row. On the left you have the collapse icon and the row counter, again these barely fit when the row is collapsed.

    Take a look at the layouts and the CSS involved and come up with a plan. I’m also working on a project right now where this would be extremely useful.

    Here’s what would be involved when the button is clicked, and the complexities listed her might give you some idea of why Elliot hasn’t added something like this. It’s far from simple.

    1. Find the next row, if the isn’t a next row find the clone row
    2. trigger a click on the add row button of the next row or the main add row button if using the clone row.
      • This is going to need to be recursive if there’s a nested repeater
      • Going to get even more complicated if there is a flex field nested in that repeater
      • It going to get even more complicated if there are clone rows
    3. get the values of the fields in the current row and insert them into the new row that was added

    For my current project I’m going to be building something that only deals with repeaters and nested repeaters, because that’s what I need. Also, the types of fields that it deals with in those repeaters will be limited and fairly simple.

  • That would be awesome! +1

  • +1, very useful.
    It would be great also for Table field add-on, since replicating similar complex tables several times could be pesky.

  • +1 For Flexible content also

  • I’ve been working on similar functionality for my Repeater Tabs plugin, updated today with the working code.

    It’s only been tested on my own use-cases, but works so far with Standard and 1-child-deep nested Repeater Fields.

    Hover over the tabs to get the “COPY” option.

    More details are in the readme.

    Hope this helps, maybe even with developing John’s further.

Viewing 25 posts - 1 through 25 (of 38 total)

The topic ‘Repeater field : duplicate row’ is closed to new replies.