Hi guys, I've been struggling with this for a while now. 😯
So my repeater has buttons connected to a database (via label). When a button is clicked it loads a video URL onto a video player. THAT WORKS GREAT! 😊
![](https://static.wixstatic.com/media/a27d24_718bd8a34db64428873498dedbadfc6c~mv2.png/v1/fill/w_980,h_430,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_718bd8a34db64428873498dedbadfc6c~mv2.png)
But what I want is that, when I click on a button it disables to indicate that its corresponding video URL has been loaded onto the video player, and then the other buttons should be enabled. In brevity, only one button should be disabled at a time in the repeater.
![](https://static.wixstatic.com/media/a27d24_0bcf4a6077354e5895a372bba4f1e53e~mv2.png/v1/fill/w_980,h_423,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_0bcf4a6077354e5895a372bba4f1e53e~mv2.png)
Here's my code
$w.onReady(function () {
$w("#repeater1").onItemReady(($item, itemData, index) => {
$item("#button1").onClick(function (event) {
let player = $w("#videoPlayer1");
player.src = itemData.videoUrl;
let selectedButonLabel = $item("#button1").label;
let currentLabel = itemData.partLabel;
const arrSelected = [];
let disabledBtn = $item("#button1").enabled;
arrSelected.push(selectedButonLabel).toString()
Check();
function Check() {
let sameLab = selectedButonLabel = currentLabel;
if (sameLab == false && disabledBtn == true) {
$item("#button1").disable()
} else if (sameLab && disabledBtn == false) { $item("#button1").disable() }
}
});
});
});
I appreciate any responses. Thank you greatly in advance. Cheers!
Walter.
SOLVED!
$w.onReady(function(){ $w("#dataset1").onReady(function(){ let selectedButton =''; $w('#repeater1').forEachItem(($item, itemData, index)=>{ $item("#button1").onClick(()=>{ let player =$w("#videoPlayer1"); player.src = itemData.videoUrl; $item("#button1").disable(); if(selectedButton !==''){ selectedButton.enable(); } selectedButton =$item("#button1"); }); }); });