Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a sub-menu item to a menu item using dojo dijit/form/DropDownButton?

I have created a Dojo DropDownButton using dijit/form/DropDownButton and created MenuItems using dijit/MenuItem. I am trying to create sub-menu items for the MenuItems so that the options are organized nicely and the user can have sub options to select from. Is there any way to do this so that the dropdown options look like this:

    Vegetables
       Carrots
       Potatoes
       Tomatoes
    Fruits
       Apples
       Oranges

instead of this (what I currently have):

    Vegetables
    Carrots
    Potatoes
    Tomatoes
    Fruits
    Apples
    Oranges
like image 526
lomokat Avatar asked Nov 29 '25 06:11

lomokat


1 Answers

Vegetables and Fruits should be dijit/PopupMenuItems and each one should contain a dijit/Menu and the menu should have the corresponding dijit/MenuItems.

The declarative menu example demonstrates it. In your case, the only difference is that instead of a context menu, the top level menu is a dijit/DropDownMenu.

http://dojotoolkit.org/reference-guide/1.9/dijit/Menu.html#declarative-markup

like image 199
Craig Swing Avatar answered Nov 30 '25 20:11

Craig Swing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!