Hi There!
When a user clicks button3 within a repeater item. The value of the field ‘place’ must increase by 1. and update to the database. I’m pretty new to javascript and I write this code with the API reference. But it doesn’t work!
Can anyone help me?
export function button3_click(event) { //button3 is within the repeater item.
let $item = $w.at(event.context);
let item = $item("#dataset1").getCurrentItem();
let position = item.place;
let itemid = item._id;
console.log(position);
let newPosition = position + 1;
console.log(newPosition);
console.log(itemid);
let toSave = {
"_id": itemid,
"place": newPosition,
wixData.save("myCollection", toSave);
};