YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

AutoComplete Widget  2.5.2

Yahoo! UI Library > autocomplete > YAHOO.widget.DS_ScriptNode

Show Private Show Protected

Class YAHOO.widget.DS_ScriptNode - extends YAHOO.widget.DataSource

Implementation of YAHOO.widget.DataSource using the Get Utility to generate dynamic SCRIPT nodes for data retrieval.

Constructor

YAHOO.widget.DS_ScriptNode ( sUri , aSchema , oConfigs )
Parameters:
sUri <String> URI to the script location that will return data.
aSchema <String[]> Data schema definition of results.
oConfigs <Object> (optional) Object literal of config params.

Properties

_nId - private static Number

Unique ID to track requests.

_nPending - private static Number

Counter for pending requests. When this is 0, it is safe to purge callbacks array.

asyncMode - String

Defines request/response management in the following manner:
ignoreStaleResponses
Send all requests, but handle only the response for the most recently sent request.
allowAll
Send all requests and handle all responses.
Default Value: "allowAll"

callbacks - static Function[]

Global array of callback functions, one for each request sent.

getUtility - Object

Alias to YUI Get Utility. Allows implementers to specify their own subclasses of the YUI Get Utility.
Default Value: YAHOO.util.Get

scriptCallbackParam - String

Callback string parameter name sent to scriptURI. For instance, requests will be sent to <scriptURI>?<scriptCallbackParam>=callbackFunction
Default Value: "callback"

scriptQueryParam - String

Query string parameter name sent to scriptURI. For instance, requests will be sent to <scriptURI>?<scriptQueryParam>=queryString
Default Value: "query"

scriptURI - String

URI to the script that returns data.

Methods

_bumpPendingDown

private void _bumpPendingDown ( )
Any success/failure response should decrement counter.
Returns: void

doQuery

void doQuery ( oCallbackFn , sQuery , oParent )
Queries the live data source. Results are passed back to a callback function.
Parameters:
oCallbackFn <HTMLFunction> Callback function defined by oParent object to which to return results.
sQuery <String> Query string.
oParent <Object> The object instance that has requested data.
Returns: void

handleResponse

void handleResponse ( oResponse , oCallbackFn , sQuery , oParent )
Parses JSON response data into an array of result objects and passes it to the callback function.
Parameters:
oResponse <Object> The raw response data to parse.
oCallbackFn <HTMLFunction> Callback function defined by oParent object to which to return results.
sQuery <String> Query string.
oParent <Object> The object instance that has requested data.
Returns: void


Copyright © 2007 Yahoo! Inc. All rights reserved.