List XHR Model is a class that interacts with the server API holding the data.
List XHR Model implements List Model Interface
Parameters:
Type | Name | Description |
---|---|---|
String | settings.apiUrl | Required. API address to interact with |
Function | settings.xhr | Optional. XHR interface. By default there is used a built-in xhr function, but you can override it here. |
Fetch options list from the server for a Select or SuggestBox editor.
The method sends GET
request to the URI = settings.apiUrl parameter taken in the constructor.
In successful case(server response status == 200) returns parsed server response, otherwise throws an error.
Parameters:
Type | Name | Description |
---|---|---|
String | search | Optional. List labels search filter(case insensitive). If the parameter is specified, the method will return only list items whose labels contain the passed string. |
Returns: Promise which resolves with the parsed server response.
Example:
Fetch the option name(label) by the specified id
from the server.
The method sends GET
request to the URI = settings.apiUrl parameter taken in the constructor.
In successful case(server response status == 200) returns parsed server response
(which is assumed to be a string value of the corresponding label), otherwise throws an error.
Parameters:
Type | Name | Description |
---|---|---|
Number | id | Required. Id of a list option to get label of. |
Example: