Hello,
I created a repeater contains: 1 image, 1 title, 1 description, 1 number, 1 button.
all these data are read from a dataset.
what i want to do is:
when i click the button, i want to increase the number +1 then save it in the dataset.
any help?
This should do the trick.
$w.onReady(() => {
$w("#myDataset").onReady(() => {
$w('#repeater').forEachItem(($item, itemData) => {
$w('#button').onClick(async () => {
let newValue = itemData++
$w("#myDataset").setFieldValue("number", newValue)
await $w("#myDataset").save()
$w("#myDataset").refresh()
})
})
})
}
I got this error:
Caused by: DatasetError: Operation (setFieldValue) not allowed on read-only dataset
Error: Operation (setFieldValue) not allowed on read-only dataset
You have unhandled error in async operation. Consider catching it and handling accordingly. DatasetError: Operation (setFieldValue) not allowed on read-only dataset
@charbel-keedy your dataset is set to read-only. Just change it to read and write.
How can i change it to read and write?
Click on the dataset element, select Settings, and you can find it in Mode: