You can use the Dropdown UI Pattern to allow users make a choice from several options. Use the Dropdown UI Pattern to offer a choice of more than four options. The Dropdown UI Pattern is used when you want to display rich content, such as images. For a very large number of options, consider using the Dropdown Select UI Pattern to avoid loss of context.
How to use the Dropdown UI Pattern
In this example, we create a dropdown containing a list of employee names from an existing database. Once an employee is selected from the dropdown, a feedback message is displayed.
In Service Studio, in the Toolbox, search for
The Dropdown widget is displayed.
If the UI widget does not display, it may be because you used a ready-made app, which deletes unused widgets from the module. To make additional widgets available in your app:
a. Go to Module > Manage dependencies.
b. Search for and select the relevant Producer, for example OutSystemsUI. Ensure Show All is selected.
c. On the Public elements for the selected Producer displayed on the right, ensure Show All is selected.
d. Search for and select the element you want to add, and click Apply.
e. In Service Studio, in the Toolbox, search for the widget again.
From the Toolbox, drag the Dropdown widget into the Main Content area of your application's screen.
On the Properties tab, in the enter a name for the Dropdown widget.
In this example, we enter
Right-click your screen name, and select Add Preparation.
From the Toolbox, drag an Aggregate onto the Preparation.
To add a database entity, double-click the Aggregate. Click the screen, and from the Select Source popup, select the database you want to use (in this example, the Employee database). Click OK.
Return to your screen by double-clicking your screen name. From the Toolbox, drag the List Records widget into the DropdownList placeholder, and on the Properties tab, from the Source Record List dropdown, select the relevant record list.
In this example, we select the GetEmployees.List.
From the Toolbox, drag an Expression widget into the List Records widget, and on the Properties tab, set the Value property to the values you want to display in the dropdown.
In this example, we set it to the employee names.
To make each of the values in the dropdown selectable, right-click the expression, and select Link to -> New Screen Action.
On the Properties tab, set the Method property to Ajax Submit.
Double-click the new screen action, and enter a name in the Name property.
In this example, we call it SelectedUser.
Double-click the new screen action, and from the Toolbox, drag the Run Server Action onto the screen action. In the Select Action popup, search for and select the Feedback_Message and click OK.
Set the message text and type.
In this example, we set the message type to Info and set the message text to display the currently selected employee.
Return to your screen by double-clicking the screen name. Right-click your screen name and select Add Local Variable. Enter a name and a default value for the variable.
Drag the variable into the dropdown Prompt placeholder and enter a name and a value.
Double-click your screen action, add an Assign, and set the variable value. In this example, we set the variable to the currently selected employee.
Add an Ajax Refresh to the screen action and in the Select Widget popup, select the widget you want to refresh.
In this example, we select the expression that holds the currently selected employee.
Select the Logic tab, navigate to Interaction -> ToggleElement and drag it onto the screen action. This closes the dropdown once a value is selected.
After following these steps and publishing the module, you can test the pattern in your app.
|ExtendedClass (Text): Optional||Adds custom style classes to the Pattern. You define your custom style classes in your application using CSS.