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.

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 has the following constructor.

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.

The following are methods for Option.

Gets the display text for the component.

Signature

Return Type

Type: String

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>.

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.

The following are constructors for OptionDataResponse.

Signature

Parameters

options

Type: List<Slack.Option>

Signature

Parameters

optionGroups

Type: List<Slack.OptionGroup>

The following are methods for OptionDataResponse.

Signature

Return Value

Type: List<Slack.OptionGroup>

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.

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 has the following constructor.

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.

The following are methods for OptionGroup.

Gets the text label of the option group.

Signature

Return Type

Type: String

Gets the list of options.

Signature

Return Type

Type: List<Slack.Option>

Apex Data Providers for External Select Component.