Issue with Query "_id" [SOLVED]

Hi Guys:

It seems to me that you are over looking the repeater scope in this code.

Each item in a repeater container has a scope that maps to the current item.

The onClick event handler takes two parameters event and $w. The $w passed to the event handler is scoped to the repeater so when you call $w(" #dataset2 ").getCurrentItem() inside a repeater element handler function you get the item for that repeater item instance.

So your mistake is that you are not letting the scope variable do its job.
$w(" #Edit ").onClick ( (event)

should be

// Note I have named the $w to $wScope to be clear that it is a different object than $w.
$w("#Edit").onClick((event, $wScoped) => {
    let currentitem = $wScoped('#dataset2').getCurrentItem();
}

This means that whenever the handler is called it is always called with the correct repeater container context. If you do this you will probably have a lot less code to write :wink:


Check out repeated item scope

Hope this helps.