Add a new item to repeater then save to collection

Hello peopleee,

I wanted to know if it’s possible to add a new item in a repeater with code.
I haven’t tried this out yet but does anyone has any idea of how to do this?

The only one I tried to do was using a dataset.new() which works but it saves to collection automatically which … no. I don’t want that

What I want:
When a user click a ‘add new Item’ Button, a new Item is added to repeater (with data) then after they’re done. They’ll click a ‘save’ button, then the items in the repeater will be BULK inserted to collection or just insert or Just get it into the collection lmao

But yea I wanted to know if anyone can do it.
thanks in advanced,

DJ bon26

A new item in repeater = a new entry in your database

See the following examples which show a number of techniques to add a new item to a Repeater:

Hello Yisreal,

Thanks but I didn’t find the links useful, I’ve been going through it for over a week and it didn’t work for me.

But also is there a to combine two arrays?
like this:

[
 {
  "_id": "food",
  "url": "wix.com"
 }
]

and this:

[
 {
  "_id": "food2",
  "url": "wix.com"
 }
]

equals this:

[
 {
  "_id": "food",
  "url": "wix.com"
  "_id": "food2",
  "url": "wix.com"
 }
]

I’ve been trying concade thingy but it doesn’t work lol

thanks,
DJ bon26

@okeyiwobi
Something like that…

  var xxx = ["Value-1", "Value-2"];
  var yyy = ["Value-3", "Value-4", "Value-5"];
  var combine = xxx.concat(yyy); 

Hi, did you find the solution for this.
I am building a application similar to LinkedIn, during profile completion phase, user can add more experience or delete it.
Repeater is more suitable with dynamic add and delete of repeater items.
I couldn’t get a way to manipulate $w ( “#repeater” ). data
Did you find the solution?

I see just two ways of how to manipulate the REPEATER-DATA.

  1. You do it directly and manualy by generating own script-codes (functions), which will be able to work with REPEATER-ARRAY-OBJECTS.
    Which will be able to …
    a) add
    b) remove
    c) join
    d) concat
    e) and so on…
    new data to the existing data-package, reloading the whole package back to repeater, after the data was modified/changed.

  2. You work with Wix-Data.

  3. Maybe there is already a VELO-PACKAGE which could help you out, i don’t know. Just saw somewhere a Velo-Package called → Wix-Data-Helpers, or something like that, maybe it could help you.

Manipulating REPEATER-DATA the direct way is nothing else, then manipulating the following structure…

[
  {
    "_id": "1",
    "firstName": "John",
    "lastName": "Doe",
    "image": "http://someImageUrl/john.jpg"
  },
  {
    "_id": "2",
    "firstName": "Jane",
    "lastName": "Doe",
    "image": "http://someImageUrl/jane.jpg"
  }
]

This is how a repeater-data looks like.
Arrays filled with objects.

Thank you, this is all I need to make progress.