Strange menu behavior between modules

The menu structure change between modules.
See the images attached. Why Is this happening between some modules but not on all.

I have created a base menu under Business, in the Vehicle module the menu is correct, but when I create new menu in Vehicle and uses this in a new module Rental, the menu structure is wrong.
The structure from Business i correct, When I make a new menu in Rental under business and create a new Module the menu from Rental is wrong.

Any idea why?

ImportedIntoNewModule

RentalMenuBase

Could someone explain me how the menu structure work between application components?
Is it so that when I create a new application component the menu structure always starts on root, or
can I put the new menu structure where ever I want in the menu structure?

I am a bit fustrated over the strange menu structure. I want to control the structure between the components, but CUBA platform does not allow me to control where I want to put my sub menus without making a lot of mess.

Can someone explain me how to control the menu structure or shall I go for a different platform?

Hi Kjell,
I think you do not need to go for another platform.
You can create any menu you want.

  1. In Studio switch menu to Single mode
    public://attachments/8e0d0548a810583f0ca19c674f02056a.jpg
    As result web-menu.xml without “+” will be written to cuba.menuConfig in web-app.properties. And platform will use only this menu config.
cuba.menuConfig = com/company/aggregator/web-menu.xml
  1. Adjust your menu. You can put a screen by its ID on any place. And no matter if the screen belongs to app component or to the current project(see the screenshot above).
    You can also edit the web-menu.xml file using IDE if Studio does something wrong.

8e0d0548a810583f0ca19c674f02056a

1 Like

But if I create a Single mode menu. This menu is only for current project.
The component extending this project is not able to use the menu when using Single mode.

When I add new menu group or item in the new project composite menu and then use this as component for the third project, the structure is wrong.

Hi,
In the third project you can:

  1. Switch the menu to Composite mode. In this case, menus from all the components (including transitively loaded) will be available as separate items of the mainMenu.
    How it works: platform searches menus in web-menu.xml of all the components and put them to the mainMenu.
  2. Create Single mode menu. Then the menu might have any structure you want. Creation of such menu seems to be not so complicated as you can use IDE and just copy the code from web-menu.xml of project components.
    When custom application component has Single mode menu this probably means that the extension project must have Single mode menu too. The reason is the following:
    If the component’s Single mode menu has system screens (for instance “Administration” menu added) and the extension project has Composite menu, the system screens will be added twice to the resulting menu. Exception will be thrown during the menu building and user will not be able to login.
1 Like