Hi Kristof, Thank you so much.
This is the code that I’m currently using:
import wixLocation from 'wix-location';
import wixData from 'wix-data';
let documents;
$w.onReady(function () {
//getting all documents from the collection
wixData.query("documents")
.find()
.then((results) => {
//setting the results to the variable declared above
documents = results.items; //see item below
})
.catch((err) => {
let errorMsg = err;
});
});
export function dropdown1_change(event, $w) {
let selectedOption = $w('#dropdown1').value;
switch (selectedOption) {
//these options are the values that were set to the dropdown
case 'ENGLISH US':
wixLocation.to(File[1].doc);
break;
case 'ENGLISH UK':
wixLocation.to(File[2].doc);
break;
case 'Sample':
wixLocation.to(File[3].doc);
break;
}
}
Do I add the string you mentioned like this under export function?
import wixLocation from 'wix-location';
import wixData from 'wix-data';
let documents;
$w.onReady(function () {
//getting all documents from the collection
wixData.query("documents")
.find()
.then((results) => {
//setting the results to the variable declared above
documents = results.items; //see item below
})
.catch((err) => {
let errorMsg = err;
});
});
export function dropdown1_change(event, $w) {
let selectedOption = $w("#dataset1").setCurrentItemIndex($w("#dropdown1").selectedIndex).then(()=>{
wixLocation.to($w("#dataset1").getCurrentItem().link)
})
switch (selectedOption) {
//these options are the values that were set to the dropdown
case 'ENGLISH US':
wixLocation.to(File[1].doc);
break;
case 'ENGLISH UK':
wixLocation.to(File[2].doc);
break;
case 'Sample':
wixLocation.to(File[3].doc);
break;
}