wix Coding to change the value in a repeater

UPDATE: Coding to change the value in a repeater

 
I´m struggling a bit with my code:
I do have a repeater (#repeater1) including some text-elements and one check-mark on each item.
my goal:
CHANGE and SAVE updated values (check-mark; Boolean-field) in a repeater. not all of them. only the selected ones.
Now I do have some strange problem with my code (see below)
when selecting an item (by CLICK) and the value "was" TRUE before, so i changed it to false I get the correct result (=false) in my database/collection.
but if the value was false and I WANT to set it and update it to "true" MY CODE re-sets the value to false after one second.
thankful for your advice's
MY CODE:
export async function repeater1_itemReady() { $w("#repeater1").forEachItem( ($item, itemData, index) => { $item("#checkbox1").onClick( (event) => { console.log("ITEM NAME " + itemData.name + "/// value of boolean: " + itemData.signedInSignedOut); // MISSING PIECE !!! let $item2 = $w.at(event.context); let newValue = $item2('#checkbox1').value; $item2('#dataset2').setFieldValue('signedInSignedOut', newValue); $item2('#dataset2').save(); //$w("#dataset2").refresh(); }); }); }
SHARE

Oscar perez

Arquitecto especialista en gestion de proyectos si necesitas desarrollar algun proyecto en Bogota contactame en el 3006825874 o visita mi pagina en www.arquitectobogota.tk

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario