| Package | com.yahoo.astra.mx.managers |
| Class | public class AutoCompleteManager |
| Inheritance | AutoCompleteManager flash.events.EventDispatcher |
targets or target property. These properties can
accept either TextInputs or containers (which hold a set of TextInputs).
Note: Due to the way TextInput sizing works, selecting a long string of text in an AutoCompleteManager's dropdown may cause the target TextInput to resize to fit the new text. If you would not like this feature, ensure that each target's width is explicitly set.
Default MXML PropertydataProvider
| Property | Defined by | ||
|---|---|---|---|
| autoFillEnabled : Boolean
Whether to complete the text in the text field
with the first item in the drop down list or not.
| AutoCompleteManager | ||
| autoSave : Boolean
Setting this value to
true will add
adding entries to the local history when a target TextInput
is focused out of. | AutoCompleteManager | ||
| caseSensitive : Boolean = false
Whether the auto complete will match based on case or not
| AutoCompleteManager | ||
| dataProvider : Object
The list of items to use for a custom auto-complete.
| AutoCompleteManager | ||
| enabled : Boolean
Setting this value to
false will stop all autocompletes
from displaying and will stop new entries from being added to the local history. | AutoCompleteManager | ||
| filterFunction : Function
A function that is used to display items that match the
function's criteria.
| AutoCompleteManager | ||
| forceSelection : Boolean = false
Whether to place the most likely completion in the TextInput
if no other selection is made.
| AutoCompleteManager | ||
| labelField : String
The name of the field in the dataprovider to display as the label, as well
as which item is used for filtering.
| AutoCompleteManager | ||
| labelFunction : Function
A user-supplied function to run on each item in the dataprovider,
to determine the label for display as well as for filtering.
| AutoCompleteManager | ||
| loopSelection : Boolean = false
A flag that indicates whether to loop the selection in the dropdown when
using the arrow keys.
| AutoCompleteManager | ||
| maxRowCount : int
The maximum number of rows that a pop-up autocomplete should display
| AutoCompleteManager | ||
| minCharsForCompletion : int
The minimum number of characters that must be typed in to display the completion list
| AutoCompleteManager | ||
| minDiskSpace : int = 0
The minimum disk space, in bytes, that you'd like to allow
for local storage.
| AutoCompleteManager | ||
| popUpEnabled : Boolean
Whether to pop up a list below the text input or not.
| AutoCompleteManager | ||
| popUpRenderer : IFactory
The custom renderer that creates a ListBase-derived instance to use
as the drop-down.
| AutoCompleteManager | ||
| shareData : Boolean
Whether to share the auto-complete data with other applications
or keep it private to this application.
| AutoCompleteManager | ||
| sharedObjectPath : String = "AutoCompleteData"
The name of the Shared Object in which to store auto-complete entries.
| AutoCompleteManager | ||
| target : Object
The TextInput or container to watch
| AutoCompleteManager | ||
| targets : Array
An Array of TextInputs or containers to watch.
| AutoCompleteManager | ||
| wordWrap : Boolean
Whether or not to wrap the text of each item in the
pop-up completion list.
| AutoCompleteManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
Constructor.
| AutoCompleteManager | ||
|
closeDropdownForTarget(target:TextInput):void
Hides the drop-down list.
| AutoCompleteManager | ||
|
Creates and returns a specific dropdown for a TextInput,
if it is set up as a target and one does not already exist
| AutoCompleteManager | ||
|
itemToLabel(data:Object):String
Creates a String for an item in the dataprovider, which is
based on the
labelField and labelFunction properties. | AutoCompleteManager | ||
|
openDropdownForTarget(target:TextInput):void
Opens a specific dropdown for a Text Input
| AutoCompleteManager | ||
|
removeAll():void
Clears all entries in the local history (shared object).
| AutoCompleteManager | ||
|
saveEntries():void
Adds the text value of all current targets to the local history.
| AutoCompleteManager | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when the pop-up completion changes selection. | AutoCompleteManager | |||
| Dispatched when the completion box becomes invisible. | AutoCompleteManager | |||
Dispatched when the dataProvider() is updated internally. | AutoCompleteManager | |||
Dispatched when the saveEntries() method saves entries. | AutoCompleteManager | |||
| Dispatched when the completion box becomes visible. | AutoCompleteManager | |||
| Dispatched when the pop-up renderer changes. | AutoCompleteManager | |||
| autoFillEnabled | property |
autoFillEnabled:Boolean [read-write]Whether to complete the text in the text field with the first item in the drop down list or not.
Note that autoFill will only work correctly if the text that
is entered matches the labelField or labelFunction.
This is because autoFill uses the textual representation of the particular field
when filling in the TextInput.
The default value is false.
public function get autoFillEnabled():Boolean
public function set autoFillEnabled(value:Boolean):void
See also
| autoSave | property |
autoSave:Boolean [read-write]
Setting this value to true will add
adding entries to the local history when a target TextInput
is focused out of.
The default value is false.
public function get autoSave():Boolean
public function set autoSave(value:Boolean):void
| caseSensitive | property |
public var caseSensitive:Boolean = falseWhether the auto complete will match based on case or not
The default value is false.
This property can be used as the source for data binding.
| dataProvider | property |
dataProvider:Object [read-write]The list of items to use for a custom auto-complete. Setting this property will forego use of Shared Objects/local history, instead filtering based upon these items. You can use a simple Array of Strings, an ArrayCollection, XML, and other popular collections.
The default value is null.
This property can be used as the source for data binding.
Implementation public function get dataProvider():Object
public function set dataProvider(value:Object):void
See also
| enabled | property |
enabled:Boolean [read-write]
Setting this value to false will stop all autocompletes
from displaying and will stop new entries from being added to the local history.
The default value is true.
public function get enabled():Boolean
public function set enabled(value:Boolean):void
| filterFunction | property |
filterFunction:Function [read-write]A function that is used to display items that match the function's criteria. A filterFunction is expected to have the following signature:
f(element:*, text:String):BooleanThe return value is
true for the function if the specified item
should displayed as a suggestion.
Whenever there is a change in text in one of the targets, this
filterFunction is run on each item in the list of potential suggestions.
The default implementation for the filter function works like this:
If "Ya" has been typed with or without leading or trailing whitespace,
it will display all the items matching
"Ya*" (Yahoo!, Yahoos, yahoo, yay, yawn, etc.), assuming caseSensitive
is set to false. If caseSensitive is true,
only items starting with a capital "Y" would be returned.
public function get filterFunction():Function
public function set filterFunction(value:Function):void
See also
| forceSelection | property |
public var forceSelection:Boolean = falseWhether to place the most likely completion in the TextInput if no other selection is made.
The default value is false.
This property can be used as the source for data binding.
| labelField | property |
labelField:String [read-write]
The name of the field in the dataprovider to display as the label, as well
as which item is used for filtering.
You set the labelField property if you are using a custom
dataprovider which is an array of objects or is XML, instead of a simple
array of Strings.
The default value is "label".
public function get labelField():String
public function set labelField(value:String):void
See also
| labelFunction | property |
labelFunction:Function [read-write]A user-supplied function to run on each item in the dataprovider, to determine the label for display as well as for filtering.
Generally, you can use the labelField property to
display the item that you want, instead of using a function.
This function takes a single parameter, the item in the data provider that you wish to use, and and returns a String based on that item.
f(item:Object):String
The default value is null.
public function get labelFunction():Function
public function set labelFunction(value:Function):void
See also
| loopSelection | property |
public var loopSelection:Boolean = falseA flag that indicates whether to loop the selection in the dropdown when using the arrow keys.
The default value is true.
This property can be used as the source for data binding.
| maxRowCount | property |
maxRowCount:int [read-write]The maximum number of rows that a pop-up autocomplete should display
The default value is 5.
public function get maxRowCount():int
public function set maxRowCount(value:int):void
| minCharsForCompletion | property |
minCharsForCompletion:int [read-write]The minimum number of characters that must be typed in to display the completion list
The default value is 1.
public function get minCharsForCompletion():int
public function set minCharsForCompletion(value:int):void
| minDiskSpace | property |
public var minDiskSpace:int = 0The minimum disk space, in bytes, that you'd like to allow for local storage. The default size for local storage is 100 KB. If you believe you will need more than this, you can pass in a value here. This will pop up a native Flash dialog asking if the user agrees to this. While Flash will do this anyway if the local storage grows above 100 KB, setting this value in advance will prevent the dialog from popping up every time there is a minor increase in needed size.
Leaving at 0 or any value less than the default 100000 (100 KB) will not have an effect.
Note that the user can always deny this increase, or disable local storage altogether.
See also
| popUpEnabled | property |
popUpEnabled:Boolean [read-write]Whether to pop up a list below the text input or not. AutoCompleteManager can be used for either pop-up style auto-complete, or simply auto-fill of the most likely entry.
The default value is true.
public function get popUpEnabled():Boolean
public function set popUpEnabled(value:Boolean):void
| popUpRenderer | property |
popUpRenderer:IFactory [read-write]The custom renderer that creates a ListBase-derived instance to use as the drop-down.
The default value is mx.controls.List.
This property can be used as the source for data binding.
Implementation public function get popUpRenderer():IFactory
public function set popUpRenderer(value:IFactory):void
| shareData | property |
shareData:Boolean [read-write]
Whether to share the auto-complete data with other applications
or keep it private to this application. TextInputs in the same domain
with the same id attribute will share the same entries if this is set to true.
Please note that setting this to true will all applications in the domain
to access any information in the Shared Object. For instance, if a third party
application hosted on the same domainknows the name of the Shared Object
(which is by default "AutoCompleteData"), they may be able to read and write to it.
If you choose to set this to true, you should consider setting the
sharedObjectPath to a value only your applications are aware of,
especially a password-like value or some value returned from a server.
In this way, you make it difficult or impossible for a third party
to access this information.
The default value is false.
public function get shareData():Boolean
public function set shareData(value:Boolean):void
See also
| sharedObjectPath | property |
public var sharedObjectPath:String = "AutoCompleteData"The name of the Shared Object in which to store auto-complete entries.
The default value is "AutoCompleteData".
| target | property |
target:Object [read-write]The TextInput or container to watch
This property can be used as the source for data binding.
Implementation public function get target():Object
public function set target(value:Object):void
| targets | property |
targets:Array [read-write]
An Array of TextInputs or containers to watch.
Setting the target property replaces all objects
in this Array.
When the targets property is set, the target
property returns the first item in this Array.
public function get targets():Array
public function set targets(value:Array):void
| wordWrap | property |
wordWrap:Boolean [read-write]Whether or not to wrap the text of each item in the pop-up completion list.
The default value is false.
public function get wordWrap():Boolean
public function set wordWrap(value:Boolean):void
See also
| AutoCompleteManager | () | constructor |
public function AutoCompleteManager()Constructor.
| closeDropdownForTarget | () | method |
public function closeDropdownForTarget(target:TextInput):voidHides the drop-down list.
Parameterstarget:TextInput — The TextInput instance to close the dropdown for
|
| getDropdownForTarget | () | method |
public function getDropdownForTarget(textInput:TextInput):ListBaseCreates and returns a specific dropdown for a TextInput, if it is set up as a target and one does not already exist
ParameterstextInput:TextInput — The TextInput instance
|
ListBase —
An instance of List
|
| itemToLabel | () | method |
public function itemToLabel(data:Object):String
Creates a String for an item in the dataprovider, which is
based on the labelField and labelFunction properties.
data:Object — Object to be rendered.
|
String — The string to be displayed based on the data.
|
See also
| openDropdownForTarget | () | method |
public function openDropdownForTarget(target:TextInput):voidOpens a specific dropdown for a Text Input
Parameterstarget:TextInput — The TextInput instance to pop the dropdown from
|
| removeAll | () | method |
public function removeAll():voidClears all entries in the local history (shared object).
| saveEntries | () | method |
public function saveEntries():void
Adds the text value of all current targets to the local history.
Use this method if you have set autoSave to false
and want to manually add entries such as upon form submittal.
| change | event |
| close | event |
| dataProviderUpdated | event |
| entriesSaved | event |
flash.events.Event
Dispatched when the saveEntries() method saves entries.
See also
| open | event |
| popUpRendererChanged | event |