Hello, I have a collection with around 70 items. I get the items of this dropdown menu from a dataset collection. Therefore, I am not adding them manually. I would like to use the item selected by the customer in this dropdown menu to redirect the page to the dynamic page associated to that item.
How can I do that?
Thank you.
Yes, there is a way to do it.
1) You have a DATABASE-A with 70-items.
2) You have a DYNAMIC-PAGE connected trough a DATASET with your DATABASE-A.
3) Now you have 70-Dynamic pages.
You can make a querry of your DATABASE-A...
import wixData from 'wix-data'; // ... wixData.query("myCollection") .find() .then( (results) => { if(results.items.length > 0) { let firstItem = results.items[0]; //see item below } else { // handle case where no matching items found } } ) .catch( (err) => { let errorMsg = err; } );
Now you have a querry of 70-items.
Every of this items has an INDEX.
first-item --------> INDEX-0
second-item ---> INDEX-1
and so on.....
Your drop-down has also an INDEX! ! ! !
And now a little BRAINSTORMING for you 😁 😁 😁
Hi XCD,
I think this tutorial by the code queen is just for you:
https://www.totallycodable.com/example-dropdown-navigation
~Hope this helps!~
Arthur😁