Hi,
Having a little trouble with getting over the last hurdle with this bit of code i've created and cant quite figure out what i've got wrong.
I want visitors to be able to click on the images in the categories repeater containing images and and titles (furniture, bars, accessories etc).
I've got the code to a point when clicking on the repeater item image will change the catagory dropdown accordingly but for some reason clicking every images selects 'furniture' on the dropdown can anyone explain why this might be?
Code:
$w.onReady(function () {
});
export function imageX10_click(event, $w) {
categoryImageFilter();
subCategoryDDFilter();
}
function categoryImageFilter (){
$w("#repeater3").onItemReady( ($w, itemData, index) => {
$w("#imagex10").image = itemData.image
$w("#text22").text = itemData.category;
$w("#dropdown2").value = itemData.category
});
$w("#dataset5").setFilter( wixData.filter()
.eq("category", $w("#dropdown2").value)
);
}
function subCategoryDDFilter (){
$w("#dataset5").setFilter( wixData.filter()
.eq("category", $w("#dropdown2").value)
);
}
Link to page on website:
https://www.velvetliving.co.uk/blank-2-1
Any help would be massively appreciated in getting over this last hurdle.
Thanks,
Owen
Try:
$w.onReady(function () { $w("#repeater3").onItemReady( ($i, itemData, index) => { $i("#imagex10").image = itemData.image; $i("#text22").text = itemData.category; $i("#dropdown2").value = itemData.category; $i("#imageX10").onClick(event => { categoryImageFilter($i("#dropdown2").value); }) }); }); function categoryImageFilter (cat){ $w("#dataset5").setFilter( wixData.filter() .eq("category", cat) ); }
Or something like that. (I don't really understand the details of your idea, but you can modify the code)