private
void
__initProps
(
)
Updates and validates latest public config properties.
private
void
_cancelIntervalDetection
(
oSelf
)
Cancels text input detection by intervals.
- Parameters:
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_clearSelection
(
)
When forceSelection is true and the user attempts
leave the text input box without selecting an item from the query results,
the user selection is cleared.
private
void
_enableIntervalDetection
(
)
Enables query triggers based on text input detection by intervals (rather
than by key events).
private
void
_initContainer
(
)
Initializes the results container once at object creation
private
void
_initContainerHelpers
(
)
Initializes the results container helpers if they are enabled and do
not exist
private
void
_initList
(
)
Clears out contents of container body and creates up to
YAHOO.widget.AutoComplete#maxResultsDisplayed <li> elements in an
<ul> element.
private
void
_initListItem
(
oItem
,
nItemIndex
)
Initializes each <li> element in the container list.
- Parameters:
-
oItem <HTMLElement>
The <li> DOM element.
-
nItemIndex <Number>
The index of the element.
- Returns:
void
private
Boolean
_isIgnoreKey
(
nKeycode
)
Whether or not key is functional or should be ignored. Note that the right
arrow key is NOT an ignored key since it triggers queries for certain intl
charsets.
- Parameters:
-
nKeycode <Number>
Code of key pressed.
- Returns:
Boolean
- True if key should be ignored, false otherwise.
private
void
_jumpSelection
(
)
For values updated by type-ahead, the right arrow key jumps to the end
of the textbox, otherwise the container is closed.
private
void
_moveSelection
(
nKeyCode
)
Triggered by up and down arrow keys, changes the current highlighted
<li> element item. Scrolls container if necessary.
- Parameters:
-
nKeyCode <Number>
Code of key pressed.
- Returns:
void
private
void
_onContainerMouseout
(
v
,
oSelf
)
Handles container mouseout events.
- Parameters:
-
v <HTMLEvent>
The mouseout event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onContainerMouseover
(
v
,
oSelf
)
Handles container mouseover events.
- Parameters:
-
v <HTMLEvent>
The mouseover event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onContainerResize
(
v
,
oSelf
)
Handles container resize events.
- Parameters:
-
v <HTMLEvent>
The resize event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onContainerScroll
(
v
,
oSelf
)
Handles container scroll events.
- Parameters:
-
v <HTMLEvent>
The scroll event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onFormSubmit
(
v
,
oSelf
)
Handles form submission event.
- Parameters:
-
v <HTMLEvent>
The submit event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onIMEDetected
(
oSelf
)
Enables interval detection for Korean IME support.
- Parameters:
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onItemMouseclick
(
v
,
oSelf
)
Handles <li> element click events in the container.
- Parameters:
-
v <HTMLEvent>
The click event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onItemMouseout
(
v
,
oSelf
)
Handles <li> element mouseout events in the container.
- Parameters:
-
v <HTMLEvent>
The mouseout event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onItemMouseover
(
v
,
oSelf
)
Handles <li> element mouseover events in the container.
- Parameters:
-
v <HTMLEvent>
The mouseover event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onTextboxBlur
(
v
,
oSelf
)
Handles text input box losing focus.
- Parameters:
-
v <HTMLEvent>
The focus event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onTextboxFocus
(
v
,
oSelf
)
Handles text input box receiving focus.
- Parameters:
-
v <HTMLEvent>
The focus event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onTextboxKeyDown
(
v
,
oSelf
)
Handles textbox keydown events of functional keys, mainly for UI behavior.
- Parameters:
-
v <HTMLEvent>
The keydown event.
-
oSelf <object>
The AutoComplete instance.
- Returns:
void
private
void
_onTextboxKeyPress
(
v
,
oSelf
)
Handles textbox keypress events.
- Parameters:
-
v <HTMLEvent>
The keypress event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_onTextboxKeyUp
(
v
,
oSelf
)
Handles textbox keyup events that trigger queries.
- Parameters:
-
v <HTMLEvent>
The keyup event.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_populateList
(
sQuery
,
aResults
,
oSelf
)
Populates the array of <li> elements in the container with query
results. This method is passed to YAHOO.widget.DataSource#getResults as a
callback function so results from the DataSource instance are returned to the
AutoComplete instance.
- Parameters:
-
sQuery <String>
The query string.
-
aResults <Array>
An array of query result objects from the DataSource.
-
oSelf <Object>
The AutoComplete instance.
- Returns:
void
private
void
_selectItem
(
oItem
)
Selects a result item from the container
- Parameters:
-
oItem <HTMLElement>
The selected <li> element item.
- Returns:
void
private
void
_selectText
(
oTextbox
,
nStart
,
nEnd
)
Selects text in the input field.
- Parameters:
-
oTextbox <HTMLElement>
Text input box element in which to select text.
-
nStart <Number>
Starting index of text string to select.
-
nEnd <Number>
Ending index of text selection.
- Returns:
void
private
void
_sendQuery
(
sQuery
)
Makes query request to the DataSource.
- Parameters:
-
sQuery <String>
Query string.
- Returns:
void
private
Boolean
_textMatchesOption
(
)
Whether or not user-typed value in the text input box matches any of the
query results.
- Returns:
Boolean
- True if user-input text matches a result, false otherwise.
private
void
_toggleContainer
(
bShow
)
Animates expansion or collapse of the container.
- Parameters:
-
bShow <Boolean>
True if container should be expanded, false if container should be collapsed
- Returns:
void
private
void
_toggleContainerHelpers
(
bShow
)
Syncs results container with its helpers.
- Parameters:
-
bShow <Boolean>
True if container is expanded, false if collapsed
- Returns:
void
private
void
_toggleHighlight
(
oNewItem
,
sType
)
Toggles the highlight on or off for an item in the container, and also cleans
up highlighting of any previous item.
- Parameters:
-
oNewItem <HTMLElement>
The <li> element item to receive highlight behavior.
-
sType <String>
Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.
- Returns:
void
private
void
_togglePrehighlight
(
oNewItem
,
sType
)
Toggles the pre-highlight on or off for an item in the container.
- Parameters:
-
oNewItem <HTMLElement>
The <li> element item to receive highlight behavior.
-
sType <String>
Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.
- Returns:
void
private
void
_typeAhead
(
oItem
,
sQuery
)
Updates in the text input box with the first query result as the user types,
selecting the substring that the user has not typed.
- Parameters:
-
oItem <HTMLElement>
The <li> element item whose data populates the input field.
-
sQuery <String>
Query string.
- Returns:
void
private
void
_updateValue
(
oItem
)
Updates the text input box value with selected query result. If a delimiter
has been defined, then the value gets appended with the delimiter.
- Parameters:
-
oItem <HTMLElement>
The <li> element item with which to update the value.
- Returns:
void
Boolean
doBeforeExpandContainer
(
)
Overridable method called before container expands allows implementers to access data
and DOM elements.
- Returns:
Boolean
- Return true to continue expanding container, false to cancel the expand.
String
formatResult
(
oResultItem
,
sQuery
)
Overridable method that converts a result item object into HTML markup
for display. Return data values are accessible via the oResultItem object,
and the key return value will always be oResultItem[0]. Markup will be
displayed within <li> element tags in the container.
- Parameters:
-
oResultItem <Object>
Result item representing one query result. Data is held in an array.
-
sQuery <String>
The current query string.
- Returns:
String
- HTML markup of formatted result data.
Object | Array
getListItemData
(
)
Public accessor to the data held in an <li> element of the
results container.
- Returns:
Object | Array
- Object or array of result data or null
HTMLElement[]
getListItems
(
)
Public accessor to the internal array of DOM <li> elements that
display query results within the results container.
- Returns:
HTMLElement[]
- Array of <li> elements within the results container.
Boolean
isContainerOpen
(
)
Returns true if container is in an expanded state, false otherwise.
- Returns:
Boolean
- Returns true if container is in an expanded state, false otherwise.
void
sendQuery
(
sQuery
)
Makes query request to the DataSource.
- Parameters:
-
sQuery <String>
Query string.
- Returns:
void
void
setBody
(
sHeader
)
Sets HTML markup for the results container body. This markup will be
inserted within a <div> tag with a class of "ac_bd".
- Parameters:
-
sHeader <String>
HTML markup for results container body.
- Returns:
void
void
setFooter
(
sFooter
)
Sets HTML markup for the results container footer. This markup will be
inserted within a <div> tag with a class of "ac_ft".
- Parameters:
-
sFooter <String>
HTML markup for results container footer.
- Returns:
void
void
setHeader
(
sHeader
)
Sets HTML markup for the results container header. This markup will be
inserted within a <div> tag with a class of "ac_hd".
- Parameters:
-
sHeader <String>
HTML markup for results container header.
- Returns:
void
String
toString
(
)
Public accessor to the unique name of the AutoComplete instance.
- Returns:
String
- Unique name of the AutoComplete instance.