There are four elements designed for user selection from the list in AppMaster:
- Select
- Dropdown
- Select (enum)
- Relselect
These elements in the web application designer:
Select
This element is designed to select from a static list of options set in the editor.
After moving the Select element to the canvas, a pop-up window will appear, where you can choose whether select will take one value or several.
To add and edit options to select, click on the element, and go to the Option tab.
Dropdown
Dropdown is similar to Select, but it does not save the selected value. Dropdown often starts some BP when you click on one of the options.
To add and edit options to select, click on the element, and go to the Option tab.
Select (enum)
Select (enum) is used to select a value from an enum. When you create this element, a window appears where you have to select the data source (one of the existing enum).
Relselect
This item is used to select values from records in the database. When you create it, you should choose the data source from the list of models. After selecting the source, you will be able to select the field to display.
Let's create a RelSelect with the data source User and the field Login.
For RelSelect to work, you need to send the necessary data using the business process.
The BP must receive data using the GET block and pass it to RelSelect, using the RelSelect Update Properties block.
Let's load all the administrators of the application into RelSelect. Use the Server Request GET /user/ block. Set the default value of the input field groups to admin. So in the output data field, we will get only the users from the Admin group. Pass this data to RelSelect Update Properties.
For a data field to appear in the RelSelect Update Properties, specify a Component ID.
Now, RelSelect will display the logins of all application administrators.
The selection made by the user can later be used in the BP. There is a field selected for this purpose. It stores the selected values.
Suppose we have a task data model associated with users. With RelSelect, we can display only those tasks related to the selected user.
Let's add the task table to the page and return to the BP configured for RelSelect.
Create another BP in it for the onChange trigger, which will update the data in the table following the selection in RelSelect.
With the RelSelect Get Properties block, we get the selected user.
Expand it with Expand User, pass its ID to the block Server Request GET /task/ and pass the data to the block Table Update Data.
When selecting a user in RelSelect, the task table will display the records associated with the selected user.