Nested menu item

59 views
Skip to first unread message

Vlad

unread,
Jul 17, 2020, 10:33:16 AM7/17/20
to web...@googlegroups.com
Missing something basic, but seems to me that the following code should result in nested menu:

response.menu = [['One', False, 'link1',
                 
[
                   
['Two', False, None,
                       
['Three', False, 'link3']
                   
]
                 
]
                 
]
               
]

"One" menu items contains "two", as it should, but "two" comes out to be a simple menu item, not containing "three" in it. What's missing?? How do I make nested sub-menu items? 

Here is the resulting html, where "three" sub-item is not even present: 

<li class="nav-item dropdown">
 
<a class="nav-link dropdown-toggle" href="link1" data-toggle="dropdown">One</a>
 
<div class="dropdown-menu">
 
<a class="dropdown-item"  href="None">Two</a>
 
</div>
</li>




AGRogers

unread,
Jul 17, 2020, 11:03:08 AM7/17/20
to web...@googlegroups.com
I don't think bootstrap (which is what web2py utilises I think) allows for the second nested level. So to do it you would need to implement your own custom menu structure. 

On Sat, 18 Jul 2020, 12:33 am Vlad, <westga...@gmail.com> wrote:
Missing something basic, but seems to me that the following code should result in nested menu:

response.menu = [['One', False, 'link1',
                 
[
                   
['Two', False, None,
                       
['Three', False, 'link3']
                   
]
                 
]
                 
]
               
]

"One" menu items contains "two", as it should, but "two" comes out to be a simple menu item, not containing "three" in it. What's missing?? How do I make nested sub-menu items? 

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8e2371ef-4b20-4369-86e0-1d1ebf911952o%40googlegroups.com.

Eliezer (Vlad) Tseytkin

unread,
Jul 17, 2020, 11:04:42 AM7/17/20
to web...@googlegroups.com
Oops! 

Got it, thank you

You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/OFGY4HLlYO4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CACWMBMPH458V35O1Jh%2BKto_Ed2HznYwOsL9wW1qh%2BRe-BP093Q%40mail.gmail.com.

Annet

unread,
Aug 18, 2020, 4:55:06 AM8/18/20
to web2py-users
Hi,

I've got a two level menu, however, calling

{{=MENU(response.app_menu)}}

doesn't render a Bootstrap 4 menu like your resulting html code. It
renders something pretty ugly:

    <li class="web2py-menu-first"><a onclick=""><span class="nav-link"><i class="fas fa-home"></i></span></a></li>
    <li class="dropdown"><a href="#"><span class="nav-link"><i class="fas fa-exchange-alt"></i></span></a>
    <ul class="dropdown-menu">
      <li><a onclick=")">Our network</a></li>
      <li><a onclick="">Networks we joined</a></li>
     </ul>
   </li>
  </ul>
</div> <!-- /.collapse -->


Do you have any idea how to solve this issue?

Kind regards,

Annet

Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:

Vlad

unread,
Aug 18, 2020, 5:24:34 PM8/18/20
to web2py-users
I may be missing something, but it seems to me that by design MENU helper produces regular, simple menu code, as it's not bootstrap-enabled by itself. I mean, this was my assumption to begin with; that's why I haven't even tried it - rather setting up menu as a list  of items  (i.e. data structure to be used in menu, which by default belongs to menu.py) and in layout.html I create an explicit bootstrap menu, iterating over the list, using appropriate html code, and this is how I use it. 

AGRogers

unread,
Aug 18, 2020, 6:48:51 PM8/18/20
to web...@googlegroups.com
I'm pretty sure that bootstrap doesn't allow nesting menus more than a single level. If you need more you need to use a custom menu system.

I'm not sure how that applies to web2py's menu system. But I suspect it too only accommodates a single level by design. 

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

Dave S

unread,
Aug 30, 2020, 4:47:15 AM8/30/20
to web2py-users


On Tuesday, August 18, 2020 at 3:48:51 PM UTC-7, AGRogers wrote:
I'm pretty sure that bootstrap doesn't allow nesting menus more than a single level. If you need more you need to use a custom menu system.

I'm not sure how that applies to web2py's menu system. But I suspect it too only accommodates a single level by design. 

It was engineered to support multiple levels, but that was before the Bootstrap people changed their code.  I think the change happened going from 3->4,

/dps
 

To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages