17
Views
5
Comments
How to Dynamically Display Menu Labels Horizontally in Menu Block from Aggregate?
Application Type
Traditional Web
Service Studio Version
11.55.22 (Build 64167)

Screenshot of my Menu Block setup and the GetMenuItems_Root aggregate**

In this screenshot, you can see:

  • The Menu Block under Common UI Flows.

  • The GetMenuItems_Root aggregate which fetches top-level menu entries from the MenuItem entity.

  • The top menu area where I want the dynamically loaded menu labels (e.g., "MenuA", "MenuB") to appear horizontally when the app runs.

Currently, this area shows the placeholder "Drag screens to this container to create menu entries", but I want to render the menu dynamically based on the aggregate results.

2023-02-19 05-11-08
Faais

Hi, 

Use list widget and set the aggregate as source 

2024-10-03 06-30-47
Bharathiraja Loganathan

Hi, 

To dynamically display menu labels horizontally in a Menu Block using an Aggregate in OutSystems (Traditional Web), follow these step-by-step instructions:(OutSystems Success)

Step-by-Step Guide

1. Create or Modify the Menu Block

  • Navigate to the Interface tab in Service Studio.

  • Under UI Flows > Common, locate the existing Menu Block or create a new one.(OutSystems)

2. Add an Aggregate to Fetch Menu Items

  • Within the Menu Block, add an Aggregate (e.g., GetMenuItems_Root) that retrieves your menu items from the MenuItem entity.

  • Apply filters as needed (e.g., ParentId = NullIdentifier() to fetch top-level menu items).

3. Insert a List Widget for Dynamic Rendering

  • Drag a List widget into the desired container within the Menu Block.

  • Set the Source Record List of the List widget to the Aggregate you created (GetMenuItems_Root.List).(OutSystems)

4. Design the List Items

  • Inside the List widget, add an Expression widget to display the menu label:

    • Set the Expression to GetMenuItems_Root.List.Current.MenuItem.Label.

  • Optionally, wrap the Expression in a Link widget to enable navigation:

    • Set the Destination to the appropriate screen or URL.(OutSystems, OutSystems)

5. Arrange Menu Items Horizontally

  • To display the menu items horizontally, adjust the CSS:

    • Set the Style Classes of the List widget to include horizontal-menu or a custom class.

    • Define the horizontal-menu class in your theme or page-specific CSS:

      .horizontal-menu {

        display: flex;

        flex-direction: row;

        list-style-type: none;

        padding: 0;

        margin: 0;

      }


      .horizontal-menu li {

        margin-right: 20px;

      }


      }

    • Ensure that each List Item (

    • ) is styled appropriately to align horizontally.


6. Test the Menu

  • Publish your application.

  • Navigate to a screen that includes the Menu Block.

  • Verify that the menu items are displayed horizontally and reflect the data from your Aggregate.(OutSystems)

By following these steps, you can dynamically render horizontal menu labels in your OutSystems application using data from an Aggregate.

Thanks,
bharathiraja


UserImage.jpg
TravelerAutumn



<Result>

The menu is listed vertically rather than horizontally.

2023-02-19 05-11-08
Faais

It's horizontal by default because expression is inline element, try removing the CSS,

UserImage.jpg
TravelerAutumn

I've done it by applying the class to the List widget, not the Expression widget. Thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.