Package | feathers.data |
Class | public class URLAutoCompleteSource |
Inheritance | URLAutoCompleteSource starling.events.EventDispatcher |
Implements | IAutoCompleteSource |
Product Version : | Feathers 2.1.0 |
AutoComplete
component
by loading data from a URL.
Data may be filtered on the server or on the client. The
urlRequestFunction
may be used to include the text from the
AutoComplete
in the request sent to the server.
Alternatively, the parseResultFunction
may filter the
result on the client.
By default, the URLAutoCompleteSource
will parse a JSON
string. However, a custom parseResultFunction
may be
provided to parse other formats.
See also
Property | Defined By | ||
---|---|---|---|
parseResultFunction : Function
A function that parses the result loaded from the URL. | URLAutoCompleteSource | ||
urlRequestFunction : Function
A function called by the auto-complete source that builds the
flash.net.URLRequest that is to be loaded. | URLAutoCompleteSource |
Method | Defined By | ||
---|---|---|---|
URLAutoCompleteSource(urlRequestFunction:Function, parseResultFunction:Function = null)
Constructor. | URLAutoCompleteSource | ||
load(textToMatch:String, suggestionsResult:IListCollection = null):void
Loads suggestions based on the text entered into an
AutoComplete component. | URLAutoCompleteSource |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the suggestions finish loading. | URLAutoCompleteSource |
parseResultFunction | property |
parseResultFunction:Function
A function that parses the result loaded from the URL. Any plain-text data format may be accepted by providing a custom parse function. The default function parses the result as JSON.
The function is expected to have one of the following signatures:
function( loadedText:String ):Object
function( loadedText:String, textToMatch:String ):Object
The function may accept one or two arguments. The first argument
is always the plain-text result returned from the URL. Optionally,
the second argument is the text entered into the
AutoComplete
component. It may be used to filter the
result on the client side. It is meant to be used when the
urlRequestFunction
accepts zero arguments and does not
pass the text entered into the AutoComplete
component
to the server.
public function get parseResultFunction():Function
public function set parseResultFunction(value:Function):void
See also
urlRequestFunction | property |
urlRequestFunction:Function
A function called by the auto-complete source that builds the
flash.net.URLRequest
that is to be loaded.
The function is expected to have one of the following signatures:
function( textToMatch:String ):URLRequest
function():URLRequest
The function may optionally accept one argument, the text
entered into the AutoComplete
component. If available,
this argument should be included in the URLRequest
, and
the server-side script should use it to return a pre-filtered result.
Alternatively, if the function accepts zero arguments, a static URL
will be called, and the parseResultFunction
may be used
to filter the result on the client side instead.
public function get urlRequestFunction():Function
public function set urlRequestFunction(value:Function):void
See also
URLAutoCompleteSource | () | Constructor |
public function URLAutoCompleteSource(urlRequestFunction:Function, parseResultFunction:Function = null)
Constructor.
ParametersurlRequestFunction:Function | |
parseResultFunction:Function (default = null )
|
load | () | method |
public function load(textToMatch:String, suggestionsResult:IListCollection = null):void
Loads suggestions based on the text entered into an
AutoComplete
component.
If an existing ListCollection
is passed in as the
result, all items will be removed before new items are added.
Parameters
textToMatch:String | |
suggestionsResult:IListCollection (default = null )
|
complete | Event |
starling.events.Event
starling.events.Event.COMPLETE
Dispatched when the suggestions finish loading.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
data | A ListCollection containing
the suggestions to display. |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |