Hello Corvid Community,
I’ve got a problem on my code, but I don’t seem to find a solution by searching on other questions.
I’m collapsing buttons inside of a repeater, based on data contained in a dataset. If the link field is empty, the button collapses. I’m trying to make it for two categories, Ambassadors and Members, and I have a distinct datasets for each. Below my code:
//Member Social Links Collapse (from dataset input)
$w.onReady( () => {
$w( ‘#membersDataset’ ).onReady( () => {
$w( “#membersRepeater” ).onItemReady(($i, itemData, index) =>{
if (!itemData.memberLinkedinLink) {
$i( “#memberLinkedin” ).collapse();
}
});
});
$w( '#membersDataset' ).onReady( () => {
$w( "#membersRepeater" ).onItemReady(($i, itemData, index) =>{
if (!itemData.memberTwitterLink) {
$i( “#memberTwitter” ).collapse();
}
});
});
});
//Ambassadors Social Links Collapse (from dataset input)
$w.onReady( () => {
$w( ‘#ambassadorsDataset’ ).onReady( () => {
$w( “#ambassadorsRepeater” ).onItemReady(($i, itemData, index) =>{
if (!itemData.ambassadorLinkedinLink) {
$i( “#ambassadorLinkedin” ).collapse();
}
});
});
$w( '#membersDataset' ).onReady( () => {
$w( "#membersRepeater" ).onItemReady(($i, itemData, index) =>{
if (!itemData.ambassadorTwitterLink) {
$i( “#ambassadorTwitter” ).collapse();
}
});
});
});
My problem is that this code works only for the Members and not the Ambassadors, as shown in the image below:
I’ve also received this error message when previewing:
Failed to get data from (new) server: SyntaxError: Unexpected token < in JSON at position 0
If anyone can help me understand what I’m doing wrong, it would be greatly appreciated.
Thanks,
Mario