$w('#listRepeater').onItemReady(($w, itemdata, index) => {
$w('#button7').onClick(() => {
let toInsert = {
"patient": itemdata.title,
"date": $w('#datePicker1').value,
"time": $w('#timePicker1').value,
}
console.log("pass 1")
wixData.insert("appointment", toInsert)
.then((results) => {
console.log("pass 2")
let item = results; //see item below
console.log("pass 3")
})
.catch((err) => {
let errorMsg = err;
}).then(()=>{
$w('#datePicker1').collapse() //do not work
$w('#timePicker1').collapse() //do not work
$w('#button6').show() //do not work
$w('#button7').hide() //do not work
})
})
})
it is just a simple insert function but the last part :
$w('#datePicker1').collapse() //do not work
$w('#timePicker1').collapse() //do not work
$w('#button6').show() //do not work
$w('#button7').hide() //do not work
dose not work where is the error in my code ?
---------------------------------------------------------------------------------
another question if there is an element in a repeater and i want to show it just in the selected item or container without showing in all items or containers in the repeater , can i do that ?and how ?
Not 100% clear without seeing your site but you probably need to substitue all instances of $w for $item.
$w refers to global scope (all elements in all repeaters).
$item refers to repeated item scope.
For example, if you do something to $w('#datePicker1'), it will affect the date picker on all items.
However, if you use $item('#datePicker1'), it will just apply to the date picker in the repeated item.