.getCurrentItem always gets the item from the first repeater

I am new to wix and have been following some tutorials. I have run into an issue where .getCurrentItem gets the first item instead of the item from the repeater that I click. I am trying to have a button that downloads the associated image, but it always downloads the first one. Any help is appreciated.
Here is the code:

$w.onReady(function () {
$w('#button19').target = "_blank";
$w('#button19').onMouseIn( (event) => {
    let item = $w('#dataset1').getCurrentItem();

    let picture = item.image;

    let url = picture.split("/")[3];

    let filename = item.fileName;
   
    $w('#button19').link = `https://static.wixstatic.com/media/${url}?dn=${filename}`;
	    
} );

While datasets have a current item index, they do not automatically match the item you click on within a repeater unless you change the index using setCurrentItemIndex( )

Instead of changing the dataset index, you can add a event handler for the repeated button in order to get the data necessary to generate a download link.

You can accomplish this using the repeater element’s onItemReady() function

Example

$w.onReady(function () {

    $w('#repeater').onItemReady(($item, itemData, index) => {
		$item('#repeatedButton').onClick(() => {
			//Handle Image Download
			console.log(itemData); //This is the item data object associated to the button that the user clicks
		})
    });

});
1 Like