Forum Academy Marketplace Showcase Pricing Features

Creating a dynamic menu / Page break in a custom state

Hi all, hi @J805 ,

I am trying to generate a set of menu items in a slidebar menu using a custom state like this (imagine a full set of these which builds up the list at each step depending on some checkbox enabled or not in the database for a given Data Type (a Venue in this case).

And the Slidebar menu would look like this

The only stumbling block I have to this (I think) it the need for a line break before each item I add. I have done some searching around the forum but not seen anything that works for a custom state. Any ideas on how I can do this, or another workaround to achieve the same?

Thanks,
David

Hey @2020travelapp :wave:

Have you tried this yet: Need Help in SlideBar Menu Plugin - #6 by fayewatson

Let me know if that works. :blush:

Hmmm looks like it might work. But how can I have it pull the words I need?

For example I need “Search” to pull in when ‘menu-enable-search’ is checked for the Venue in question.

These are the database fields in question:

Thanks as always @J805 :slight_smile:
David

Seeing how your database is set up helps. :+1:

It would be better to have those items as one list of things instead of just a bunch of yes/no fields.

That way, you could display them easily. Otherwise, it’s going to make it really hard for you.

Does that make sense?

Do you mean as an option set?

What I wanted to do was to allow the venue owner to determine which items would display for them in the admin system:

According to their choices the menu would display. How might this work?

Here is a very simple example that you can copy from. This adds it to the menu too. Check it out!

Editor: Test805421 | Bubble Editor

Preview: https://test805421.bubbleapps.io/version-test/dynamic_menu?debug_mode=true

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

  • One-on-One Tutoring
  • eLearning Hub
  • Video Tutorials

hi again @J805

Thanks for that, and apologies for the delay in responding, I had been called away to deal with something else and so this inevitably got pushed to the backburner for a bit.

Your mock-up is 90% to what I need! :slight_smile: Thanks for that.

The only problem with it is that it doesn’t preserve the order of the menu items as I need them. For example if item 3 is checked and then I add item 1, the order is item 3, then item 1 (see image), whereas I need to preserve the order of the menu items just changing whether they appear or not according to the checkboxes.

Any thoughts as to how this could be tweaked?
Thanks again, as always,
David

No problem. I hope everything is alright.

I think you would just need to do a bit more work. Make it a data type instead of just a text element and add a sort order # to it. Then have them add it with a save button at the end that will go through and add it to the list in the correct order based on the sort order #.

Does that make sense? :blush:

Hi @J805 ,

All fine thanks.

Ok so I created a Data type:
image

And added an array of these to the Venue data type:
image

Then when the user saves the venue in the admin system first step would be to clear the list:
image

Then I should build up the array like this going through each checkbox in turn.
image

This leaves me with 2 questions:

  1. What exactly do I add here?
  2. Do I actually need the sort-order in this way of doing things?

Thanks again Jason,
David

Instead of doing a clear list, just use ‘set list’ since it will do both, clear the list and set the new list.

Once you set the new list then you can sort the list with the ‘sort-order’ field and then extract the text field called ‘item’ from that sorted list.

So the last step will not be an ‘add’ to the list, it will be a ‘set list’.

Does that make more sense? :blush:

I understand your point about not needing to clear the list, but how do I build up the list with the sort order. So for example in the first instance I would want to add an entry “Search / 1” when Search is checked. But I don’t know how this would be done. See image. I feel I am just missing this one step and I can finish it. Thanks again

image

So you would do it like this, where this is a list that the user has chosen:

Do a search for Venue-Menu’s (Sort by sort order) item’s join with line_break

Instead of do a search for, it could be a set state of the list of Venue-Menu’s the user has chosen.

Does that make sense? :blush:

ok I think that works.

I need to do a couple of other checks too so it might need to be a little more complex but this is the break I needed. :slight_smile:

I think the rest I can hopefully manage.

Thanks again Jason! Great work as always!
David

1 Like

Cool, glad that should work for you. :blush: Happy to help.