Work with Options
Use these Apex classes to implement a Select component or a data provider specified by the datasource
key on an External Select component.
The sample app has several examples that use the Select and External Select components.
Creates an option for the Select or External Select component.
For the External Select component, construct your data using List<Slack.Option>
and return it using Slack.OptionDataResponse
.
Alternatively, specify the values or use an expression in the view definition for the Select or External Select component.
Usage
Construct List<Slack.Option>
to build a list of values for the Select component.
See the sample app for a full example.
Alternatively, use the Slack.Option
class to build your option list for the External Select component and return it using Slack.OptionDataResponse
.
Option Constructor
Option
has the following constructor.
Option(text, value)
Creates an instance of the Slack.Option
class with the text and value.
Signature
Parameters
text
Type: String
The text to display on the component.
value
Type: String
The value of the option.
Option Methods
The following are methods for Option
.
getText()
Gets the display text for the component.
Signature
Return Type
Type: String
getValue()
Gets the value of the option.
Signature
Return Type
Type: String
The data to return for the External Select component using a List<Slack.Option>
or List<Slack.OptionGroup>
.
Usage
Construct Slack.OptionDataResponse
with List<Slack.OptionGroup>
or List<Slack.Option>
.
Constructing a Slack.OptionDataResponse
with a combination of Slack.Option
and Slack.OptionGroup
isn’t supported. If both are present in the Slack.OptionDataResponse
, the UI doesn't update.
OptionDataResponse Constructors
The following are constructors for OptionDataResponse
.
OptionDataResponse(options)
Signature
Parameters
options
Type: List<Slack.Option>
OptionDataResponse(optionGroups)
Signature
Parameters
optionGroups
Type: List<Slack.OptionGroup>
OptionDataResponse Methods
The following are methods for OptionDataResponse
.
getOptionGroups()
Signature
Return Value
Type: List<Slack.OptionGroup>
getOptions()
Signature
Return Value
Type: List<Slack.Option>
Creates an option group for the Select or External Select component.
For the External Select component, construct your data using List<Slack.OptionGroup>
and return it using Slack.OptionDataResponse
.
Alternatively, specify the values or use an expression in the view definition for the Select or External Select component.
Usage
Use the Slack.OptionGroup
class to build your option groups for the External Select component. See Apex Data Providers for External Select Component.
Alternatively, construct your data using List<Slack.OptionGroup>
for the Select component.
See the sample app for a full example.
OptionGroup Constructor
OptionGroup
has the following constructor.
OptionGroup(label, options)
Creates an instance of the Slack.OptionGroup
class with the label and options.
Signature
Parameters
label
Type: String
The text label for the option group.
options
Type: List<Slack.Option>
A list of options to choose from.
OptionGroup Methods
The following are methods for OptionGroup
.
getLabel()
Gets the text label of the option group.
Signature
Return Type
Type: String
getOptions()
Gets the list of options.
Signature
Return Type
Type: List<Slack.Option>
Apex Data Providers for External Select Component.