A Simple Menu Bar - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

To create a menu bar:

   model.jsonModel = {
   widgets: [{
      name: "alfresco/menus/AlfMenuBar",
      config: {
         widgets: [{
               name: "alfresco/menus/AlfMenuBarItem",
               config: {
               label: "One"
            }
            },{
               name: "alfresco/menus/AlfMenuBarItem",
               config: {
               label: "Two"
            }
         }]
      }
   }
]}; 

This creates a basic menu bar with two menu items.

The key thing to note here is the use of the widgets attribute in the config object of the alfresco/menus/AlfMenuBar. Where one widget can be the parent to several child widgets it is always possible for the model for those children to be defined in an array assigned to the widgets attribute. This repeating pattern is one of the many ways in which Surf is able to establish all the dependencies to load onto the page.