Well then i was wrong thinking of that you use a collection:
Anyway, a repeater consists of a simple → Array filled full of → Objects.
You will find the following structure in every REPEATER-DATA…
SIMPLE-REPEATER-STRUCTURE!
[
{
"_id": "1",
"firstName": "John",
"lastName": "Doe",
"image": "http://someImageUrl/john.jpg"
},
{
"_id": "2",
"firstName": "Jane",
"lastName": "Doe",
"image": "http://someImageUrl/jane.jpg"
}
]
Read also the REPEATER-INTRODUCTION, it will open your eyes.
If you want to go hard way (on my opinion hard way) you will have to manipulate the Object-Array manually through an own created function (return-function) and refeed your REPEATER with modified DATA again.
But my suggestion would still be to use a COLLECTION!
See the COLLECTION as a side-step (BYPASS).
Working from out of a COLLECTION would make things a little bit easier (my opinion, if i am wrong → show me better ways).
Once you have stored your data into a DATABASE, you can start to use wix-Data-API.
Of course you can do it the direct way, without BYPASS.
You need an example how to manipulate REPEATER - DATA ?
EXAMPLE: let’s take this as example REP-DATA!
Let’s say you want to manipulate it and change FirstName and LastName of ----> John-Doe to Velo-Ninja.
[
{
"_id": "1",
"firstName": "John",
"lastName": "Doe",
"image": "http://someImageUrl/john.jpg"
},
{
"_id": "2",
"firstName": "Jane",
"lastName": "Doe",
"image": "http://someImageUrl/jane.jpg"
}
]
You have everything inside your “data in an array”…
let myDataInAnArray = [
{
"_id": "1",
"firstName": "John",
"lastName": "Doe",
"image": "http://someImageUrl/john.jpg"
},
{
"_id": "2",
"firstName": "Jane",
"lastName": "Doe",
"image": "http://someImageUrl/jane.jpg"
}
]
We defined our BASE-DATA.
This will feed your REPEATER with the DATA-PACKAGE and show your items on screen on your REPEATER (if you have connected it trough a DATASET)
$w('#repeater).data = myDataInAnArray;
If not, you will need onItemReady() to show the repeater-data.
So now we are starting to change it, what we want is…
[
{
"_id": "1",
"firstName": "VELO",
"lastName": "NINJA",
"image": "http://someImageUrl/john.jpg"
},
{
"_id": "2",
"firstName": "Jane",
"lastName": "Doe",
"image": "http://someImageUrl/jane.jpg"
}
]
getting DATA out of REPEATER…
let myData = $w('#repeater).data
let xxx = myData[0]["firstName"]; console.log(xxx);
let yyy = myData[0]["lastName"]; console.log(yyy);
You already understand what i want to show you ???
myData[0][“firstName”] = “VELO”;
myData[0][“lastName”] = “NINJA;”
Aaaaaaaand → back to REPEATER…
$w('#repeater).data = myData;
BTW: Sorry for my sarcastic style, nothing personaly, just like to be sarcastic sometimes. Even Yisrael knows it 