Hi, I’m searching for a way to hide a button in a repeater when there’s no data for the specific container in the referenced dataset.
A little bit more explanation: I have a page with a main dataset (dataset1). To this dataset a repeater (repeater1) and it’s objects are linked. On the same page I have a second dataset (dataset2) who is filtered with a reference field to dataset1 (field xxx same as dataset1).
I now want a button in my repeater (for every container) to only be shown if there’s data to be found in the referenced dataset 2 for the data of that container.
Hope you understand what I mean…
Until now I have this, but it only works for the first container in the repeater even if there’s a forEachItem in the code:
$w.onReady( function () {
$w(“#dataset2”).onReady( () => {
$w(“#repeater1”).forEachItem( ($item, itemData, index) => {
let count = $w(‘#dataset2’).getTotalCount()
if (count === 0) {
$w(‘#buttonAntwToev’).show()
$w(‘#buttonAntwoorden’).hide()
} else {
$w(‘#buttonAntwToev’).hide()
$w(‘#buttonAntwoorden’).show()
}
})
})
})
Thanks for your help