Main database has different fields with references to multiple other databases.
Have a repeater with a search function based on dropdown value. And a button that links to separate dynamic pages of the referenced columns.
I am getting the repeater working properly. But the button is not linking properly to the referenced field.
function search() {
wixData.query("MainProductDatabase")
.contains("mainCategory", String($w("#dropdown1").value)) //change to string value
.and(wixData.query("MainProductDatabase").contains("subCategory", String($w("#dropdown2").value)))
.find()
.then(results => {
$w("#repeater1").data = results.items;
console.log(results.items);
let maincategory = results.items[0].mainCategory;
console.log("maincategory" + maincategory);
if(maincategory === "Teleskoptruck") {
$w("#button3").show();
$w("#button4").hide();
// $w("#button4").collapse();
$w("#button5").hide();
// $w("#button5").collapse();
console.log("button hidden");
}
else if (maincategory === "Truck"){
$w("#button4").show();
$w("#button3").hide();
// $w("#button3").collapse();
$w("#button5").hide();
//$w("#button5").collapse();
console.log("button 4 shown");
}
else if (maincategory === "Lift"){
$w("#button5").show();
$w("#button4").hide();
//$w("#button4").collapse();
$w("#button3").hide();
//$w("#button3").c5 ollapse();
console.log("button 5 shown");
}
});
}
I have linked three different buttons to each referenced column, based on which the button links to the dynamic.
The problem - I am getting the button3 to link properly to its resp dynamic page, but button 4 and 5 do not link to their dynamic page. The button remains without value.
What could be the issue?