setOptions
Description
Allows users to set a value to a component.
Input / Parameter
component
The name of the component.
String/Text
-
-
Yes
data
The id of the component.
Array/List
-
-
Yes
valueField
The name of the attribute from the list of options (from data parameter) to be as the value of the dropdown options.
String/Text
-
-
Yes
displayField
The name of the attribute from the list of options (from data parameter) to be as the display of the dropdown options.
String/Text
-
-
Yes
Output
Returns the formatted information.
Object
Note: The component will be updated to show the value that has been set to it.
Object
success
Boolean value to denote whether the function was executed successfully.
Text
message
The message to print.
Text
data
Any additional message or data to print.
Text
Example
In this example, we have a button (in blue) that when clicked will populate the dropdown of the component.
Steps
First, we drag a button and a dropdown input onto the Editor.
Select the button and under the 'Actions' tab, drag the
Component.setOptions
into the flow for the button.Under the inspector for this function, select the component whose dropdown you would be populating, which in this example is
Dropdown411
, and then fill in valueField and displayFieldAdd the function
Conversion.toList
in the 'data' parameter using the 'function' parameter type.Then add
Conversion.toObject
inside each parameter of theConversion.toList
function. The object must follow valueField and displayField that has been set
Result
Save and preview your app.
Now when you click the button, it will set the dropdown of Dropdown411.
Links
Related Information
See also:
Components
Last updated