Dynamic Menu

Hello,

I have set up a database from which I am creating a large number of pages using a dynamic page template.

The database includes a column for Categories (for now I have 4 Catagories) and a column of Topics, which are a subset of the Catagories. Each topic represents a website page.
I am ultimately trying to setup a dynamic Menu for my website which updates each time I ad a new Category and or Topics to my database.
I would like each Category to appear as the main menu and then when I hover the mouse over the menu I want each of Topics to be available for selection sitting underneath their associated Category.

To try and achieve this I was thinking of making a lightbox menu into which I embed a table. I was hoping to be able to connect the column headers to the Categories of my database, and then the table rows to connect to the associated Catagoy Topics. Effectively creating a ‘repeater’ which is dynamic in both rows and columns at the same time. However it doesn’t appear tables are able to be set up in such a way.

Are you able to assist me with this?

Thank you

Hi nathan,

You have several options to create the desired module:
In case your categories number is small, you can manually create a button for every category.
For each button, create a hidden repeater, which holds all the topics. onclick/hover, show the repeater.

If you still want to keep your categories dynamic, you can create another table, and use multi-references (CMS: Working with Multiple-Item Reference Fields | Help Center | Wix.com).
Now, you can have two repeaters, one for each collection.
The repeater of the topics will be hidden. again, onclick/hover, you will display the second repeater with the data references from the selected category.

Here is a reference for using repeaters: https://www.wix.com/code/home/repeaters.

I hope you’ll find this useful.
Idan.

Hi Idan,

Thank you very much for the feedback. I have looked into it and managed to progress this far:

  • Created a ‘Catagories’ database and included a Reference field type called ‘Topics’ which is connected to my ‘Topics’ collection.

-These two databases are now dynamilcally linked so that when I add a new topic in the Topics collection i can easily associatte it with the Catergory. Also if i add a new catagory in the Catgory collection it then becomes immediatly availavle as an option for me to select in the Topics collection.

I am now stuck progressing to the next stage of creating my dnnamic menu. A few notes:

  • I have looked at the following link:CMS: About Displaying Content from Multiple Database Collections Using Reference Fields | Help Center | Wix.com. After adding a ‘Catagories’ and 'Topics’database to my page and then filtering the 'Topic’database to include the ‘Catagories’ database i cant get my table to connect to the Reference filed type column within either database.

  • Wiith regard to your idea above about having two seperate tables, how would I ensure the topics always appear below/associatted to the correct Catagory. I would have thought I would need to keep it all withon one table with ‘Catagories’ associatted woth the table header and then ‘Topics’ dynamically populating below the ‘Catagory’.

Thanks for the help

Hey Nathan,

Sounds like you’ve made good progress.
For getting the references data, take a look at this API: wix-data - Velo API Reference - Wix.com.

Good luck,
Idan.