Class: SearchWidget

SearchWidget(configopt)

new SearchWidget(configopt)

Parameters:
Name Type Attributes Description
config Object <optional>

Configuration options.

Properties
Name Type Attributes Default Description
limit number <optional>
10
api mw.Api <optional>

Optional MediaWiki API, for testing

favoritesStore FavoritesStore

Data store

Source:

Extends

  • OO.ui.ComboBoxInputWidget

Methods

(protected) getLookupCacheDataFromResponse(response) → {Array.<Object>}

Pre-process data returned by the request from {@see getLookupRequest}.

The return value of this function will be cached, and any further queries for the given value will use the cache rather than doing API requests.

Parameters:
Name Type Description
response Object

Response from server

Source:
Returns:

Config for {@see TemplateMenuItem} widgets

Type
Array.<Object>

(protected) getLookupMenuOptionsFromData(data) → {Array.<OO.ui.MenuOptionWidget>}

Get a list of menu option widgets from the (possibly cached) data returned by {@see getLookupCacheDataFromResponse}.

Parameters:
Name Type Description
data Array.<Object>

Search results from {@see getLookupCacheDataFromResponse}

Source:
Returns:
Type
Array.<OO.ui.MenuOptionWidget>

(protected) getLookupRequest() → {jQuery.Promise}

Get a new request object of the current lookup query value.

Source:
Returns:

jQuery AJAX object, or promise object with an .abort() method

Type
jQuery.Promise

(protected) onLookupMenuChoose(item)

Handle menu item 'choose' event, updating the text input value to the value of the clicked item.

Parameters:
Name Type Description
item OO.ui.MenuOptionWidget

Selected item

Source:
Fires: