Expand all

mw.widgets.SelectWithInputWidget

Select with input widget. Displays an OO.ui.TextInputWidget along with an OO.ui.DropdownInputWidget. TODO Explain the OTHER option

Example

mw.loader.using( 'mediawiki.widgets.SelectWithInputWidget', function () {
  let swi = new mw.widgets.SelectWithInputWidget( {
    or: true,
    dropdowninput: {
      options: [
        { data: 'other', label: 'Other' },
        { data: 'a', label: 'First' },
        { data: 'b', label: 'Second' },
        { data: 'c', label: 'Third' }
      ]
    },
    textinput: {
    }
  } );

  $( document.body ).append( swi.$element );
} );

Extends

Constructor

new mw.widgets.SelectWithInputWidget([config]) #

Create an instance of mw.widgets.SelectWithInputWidget.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
dropdowninput Object optional

Config for the dropdown

textinput Object optional

Config for the text input

or boolean optional
false

Config for whether the widget is dropdown AND input or dropdown OR input

required boolean optional
false

Config for whether input is required

Source:

Methods

getValue() → {string} #

Get the value from outside.

Source:

Returns:

Type
string
Get the value from outside.

setValue(value) #

Set the value from outside.

Parameters:

Name Type Description
value string | undefined
Source:
Set the value from outside.

gatherPreInfuseState()static #