Using context id to pass data to a specific item on a specific row in a repeater.

Does anyone know if it’s possible to send a value from a text box outside of a repeater to a specific text box on a specific row in a repeater.

The only real connection I can find is event . context . itemId

If I use

let itemId = event.context.itemId ;

on a click event on the target element and console log it it does send back an id which I assume is for the control producing the onClick event? It gives me back an id that looks like this;

4b8500e2-a210-4d76-b022-291993891b8f

However, if the repeater is refreshed, then it appears to then give the control a fresh id. This should not be an issue as, there will be no need to refresh the repeater for what I’m trying to do.

I just need to construct some code to send a value from a text box outside of the repeater to the control identified by the context.itemid (within the repeater).

Of course I might be totally on the wrong track

Happy to provide any clarification.

Does anyone know if it’s possible to send a value from a text box outside of a repeater to a specific text box on a specific row in a repeater.

Why this should’t be possible?

Everything is possible!

But first you have to ask yourself… WHAT DOES IT MEAN…

“specific text box on a specific row in a repeater”

Isn’t it just data somewhere inside a database, which is shown inside a repeater, connected through CODE or a DATASET ?

YES —> IT IS !!!

Velo-Ninja, what the hell do you wanna tell me?

You mean, i have just to write the data back into DATABASE when i click my BUTTON and emmidiately reload the data back to repeater?

What do you think would be the right answer here ? ? ?

Of course you want to write the data into the right DB-FIELD and into the right row.

What does this mean again??? WTH ???
Aaaaaa, i got you!

You wannt me first to read data → update the right VALUE of the data and write it back to DB ???

I GOT YOU !!!

Velo-Ninja OVER !

It is NOT data in a database, it is data in an array that is being displayed in the repeater. There is no connection to a collection, it is an array that has been populated by a fetch from the Twitter API.

I have some external messaging clips are being called from a collection and being displayed in a second repeater. Repeater 1 is recreating a Twitter feed
and the repeater has an unbound field that expands to offer the user an opportunity to quote tweet. It will never touch a collection, as soon as the message is sent it is cleared the Twitter feed refreshed and user can select another message to interact with.

I am trying to pass data to the unbound text box on a specific row in the repeater which appears to have a context id. My question is, how do I use that context.itemid to send a string to a specific text box on the repeater displaying the twitter feed.

Whilst I understand you have a wealth of experience with Velo, it does nothing to encourage users to ask questions if you frame your response in this manner.

I am not trying to be deliberately vague, I can only frame the question as I see it.

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 :grin: