Hello, I’m creating the first christian music platform universal. It’s open for christian, musulman, buddist, jewish, orthodox and atheist.
My problem, this code :
import wixData from 'wix-data';
import wixLocation from 'wix-location';
/*
let opts = $w("#dropdown1").options;
$w.onReady(function () {console.log("yyy")
yyy()
});
function yyy () {
wixData.query("DatabaseNationsNorth")
.find()
.then(async(results) => {//console.log("RESULTS: ", results)
if(results.items.length > 0) {
let firstItem = await results.items[0]; //see item below
let items = await results.items
let length = await results.items.length
xxx (items, length)
//tipenaboNorth
} else {
// handle case where no matching items found
}
} )
.catch( (err) => {
let errorMsg = err;
} );
}
function xxx (items, length) {
console.log("ITEMS: ", items)
console.log("LENGTH: ", length)
//let opts = $w("#dropdown1").options;
for (var i = 0;
i < length; i++) {
console.log(items[i].tipenaboNorth)
opts.push({"label": items[i].tipenaboNorth, "value": items[i].tipenaboNorth});
$w("#dropdown1").options = opts;
}
}*/
export function dropdown1_change(event) {
$w("#dataset2").setFilter( wixData.filter()
.eq("tipenaboNorth", $w('#dropdown1').value))
.then(linkUrl);
}
function linkUrl(){
let url = $w('#dataset2').getCurrentItem().url;
wixLocation.to(url);
}
When I select the dropdown with my nation can I make a link to another page.
Thank you so much for your help.