DirectDropDown
Overview
This widget allow to use a dropdown without requiring an association. It is designed for scenarios where the possible values come from an external API or database instead of being stored within the Mendix domain model.
Features
- ✅ No association needed – Directly bind the dropdown to an attribute.
- ✅ Flexible data sources – Fetch options from microflows, APIs, or external databases.
- ✅ Seamless integration – Works in CRUD applications with dynamic reference data.
- ✅ Configurable UI – Customize labels.
Configuration
- Bind Attribute: Select a String or Enumeration attribute to store the selected value.
- Data Source: Choose from:
- Microflow – Fetch options dynamically from logic.
- Database – Retrieve values from an external database via an API.
Known Limitations
- Not suitable for multi-select dropdowns (future enhancement)
Problem Statement
A Mendix-based Order Management System allows users to create and update orders. The order status must be selected from a predefined list of possible values, but these values:
- Are not stored in Mendix, as they are managed by an external system.
- Are fetched via an API call or external DB.
- May change dynamically over time.
By default, Mendix dropdowns require an association, making it difficult to use external data sources for selection.
Solution: Custom Dropdown Widget (No Association Required)
With this widget, we can:
✅ Fetch order statuses directly from the external API.
✅ Bind the dropdown to the "Status" attribute of the Order entity without requiring an association.
✅ Ensure real-time updates whenever the API values change.
Implementation Steps
- Add the Custom Dropdown Widget to the Order Edit Page.
- Bind it to the "Status" attribute of the Order entity.
- Configure the data source to call a microflow that fetches possible statuses from the API.
- Enable default selection and sorting (if required).
How It Works
- The widget calls a microflow that fetches status options from the external API.
- The dropdown dynamically displays the retrieved values.
- When a user selects a status, the chosen value is stored in the Order entity’s "Status" attribute.
- The API values can be updated anytime without changing the Mendix domain model.
Result
- 🎯 No need to store possible values in Mendix – fully API-driven.
- 🚀 Faster and more flexible implementation – no entity associations required.
- 🔄 Real-time updates – always fetches the latest values from the external system.
This use case applies to any scenario where dropdown values come from an external source, such as customer types, subscription plans, product categories, or approval statuses.
Documentation
Typical Usage Scenario
Mendix applications often need dropdowns populated with dynamic values from an external API or database. However, Mendix’s default dropdowns require an association, making it difficult to handle such cases without modifying the domain model.
This Custom Dropdown Widget solves this problem by:
- Allowing dropdown values to be fetched dynamically from REST APIs, microflows, or external databases.
- Eliminating the need for associations or extra entities in Mendix.
- Providing a flexible, reusable solution for any scenario where dropdown values are managed outside Mendix.
Example Use Cases:
- Order Management: Fetch possible order statuses from an external system.
- Customer Selection: Show a list of customers without storing them in Mendix.
- Subscription Plans: Dynamically load pricing plans from an API.
Features and Limitations
Features
✅ Works without associations – directly binds to an entity’s attribute.✅ Supports various data sources:
- Microflows
- REST APIs
- External Databases✅ Works with String and Enumeration attributes.✅ Customizable UI: Set default values, sorting, and labels.✅ Compatible with Mendix 9.x and above.
Limitations
⚠️ No multi-select support (Planned for future versions).
⚠️ Dependent on data source availability – API or microflow must return values correctly.
Installation
- Download the widget from the Mendix Marketplace.
- Open Mendix Studio Pro and import the widget via App Explorer → Marketplace Modules.
- Drag and drop the Direct Dropdown Widget onto a page.
Configuration
- Bind Attribute: Select a String or Enumeration attribute from your entity.
- Choose Data Source:
- Microflow: Select a microflow that retrieves values dynamically.
- Database: Connect to an external database via API.
- Set Display Properties: Customize labels, sorting, and default values.
- Test and Publish: Ensure the dropdown displays the correct values in different scenarios.