Packagefeathers.data
Classpublic class URLAutoCompleteSource
InheritanceURLAutoCompleteSource Inheritance starling.events.EventDispatcher
Implements IAutoCompleteSource

Product Version : Feathers 2.1.0

Creates a list of suggestions for an 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

feathers.controls.AutoComplete


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Events
 Event Summary Defined By
  Dispatched when the suggestions finish loading.URLAutoCompleteSource
Property Detail
parseResultFunctionproperty
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.


Implementation
    public function get parseResultFunction():Function
    public function set parseResultFunction(value:Function):void

See also

urlRequestFunctionproperty 
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.


Implementation
    public function get urlRequestFunction():Function
    public function set urlRequestFunction(value:Function):void

See also

Constructor Detail
URLAutoCompleteSource()Constructor
public function URLAutoCompleteSource(urlRequestFunction:Function, parseResultFunction:Function = null)

Constructor.

Parameters
urlRequestFunction:Function
 
parseResultFunction:Function (default = null)
Method Detail
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)

Event Detail
complete Event
Event Object Type: starling.events.Event
Event.type property = starling.events.Event.COMPLETE

Dispatched when the suggestions finish loading.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
dataA ListCollection containing the suggestions to display.
targetThe 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.