Search.../

options

Sets or gets the picker's options.

Description

Setting the options property sets all the options available to a mobile app user.

Getting the options property returns the current list of options available to a mobile app user.

You cannot modify the data array in-place. To add, change, or remove individual mobile picker options:

  1. Store the value of the options property in a variable.
  2. Make changes to the options array.
  3. Reset the options property with the modified array.

Type:

Array<Option>Read & Write, default value is An empty array
NAME
TYPE
DESCRIPTION
value
string

The value of the mobile picker option. This is what you use in code and is what is stored in your collections. Mandatory if label is not specified.

label
string

The label of the mobile picker option. This is what a mobile app user sees. Mandatory if value is not specified.

description
string

The description of the mobile picker option. This is what a mobile app user sees.

selected
boolean

Whether the mobile picker option is selected.

enabled
boolean

Whether the mobile picker option is enabled.

Was this helpful?

Get the picker's options

Copy Code
1let myPickerOptions = $w('#mobilePicker1').options; // [{ value: 'L', label: 'Large', description: 'Adult Large', selected: false, enabled: true }, { value: 'XL', label: 'Extra Large', description: 'Adult Extra Large', selected: false, enabled: true }]
Set the picker's options

Copy Code
1$w('#mobilePicker1').options = [
2 { value: 'S', label: 'Small', description: 'Adult Small', selected: false, enabled: true },
3 { value: 'M', label: 'Medium', description: 'Adult Medium', selected: false, enabled: true },
4 { value: 'L', label: 'Large', description: 'Adult Large', selected: false, enabled: true },
5 { value: 'XL', label: 'Extra Large', description: 'Adult Extra Large', selected: false, enabled: true }
6];