API: datasource YAHOO.util.ScriptNodeDataSource (YUI Library)

# Yahoo! UI Library

### DataSource Utility 2.8.0r4

Yahoo! UI Library > datasource > YAHOO.util.ScriptNodeDataSource
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.util.ScriptNodeDataSource - extends YAHOO.util.DataSourceBase

ScriptNodeDataSource class for accessing remote data via the YUI Get Utility.

### Constructor

YAHOO.util.ScriptNodeDataSource `( oLiveData , oConfigs )`

Parameters:
  `oLiveData <HTMLElement>` Pointer to live data.
  `oConfigs <object>` (optional) Object literal of configuration values.

### 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, to allow implementers to use a custom class.
Default Value: YAHOO.util.Get

#### scriptCallbackParam - `String`

Callback string parameter name sent to the remote script. By default, requests are sent to <URI>?<scriptCallbackParam>=callback
Default Value: "callback"

#### Properties inherited from YAHOO.util.DataSourceBase:

`_aCache, _aIntervals, _oQueue, _sName, dataType, ERROR_DATAINVALID, ERROR_DATANULL, liveData, maxCacheEntries, parseJSONArgs, responseSchema, responseType, TYPE_HTMLTABLE, TYPE_JSARRAY, TYPE_JSFUNCTION, TYPE_JSON, TYPE_LOCAL, TYPE_SCRIPTNODE, TYPE_TEXT, TYPE_UNKNOWN, TYPE_XHR, TYPE_XML, useXPath`

### Methods

#### doBeforeGetScriptNode

`String doBeforeGetScriptNode ( URI )`
Overridable method gives implementers access to modify the URI before the dynamic script node gets inserted. Implementers should take care not to return an invalid URI.

Parameters:
  `URI <String>` to the script

Returns: `String`
  URI to the script

#### generateRequestCallback

`String generateRequestCallback ( )`
Creates a request callback that gets appended to the script URI. Implementers can customize this string to match their server's query syntax.

Returns: `String`
  String fragment that gets appended to script URI that specifies the callback function

#### makeConnection

`Number makeConnection ( oRequest , oCallback , oCaller )`
Overriding method passes query to Get Utility. The returned response is then forwarded to the handleResponse function.

Parameters:
  `oRequest <Object>` Request object.
  `oCallback <Object>` Callback object literal.
  `oCaller <Object>` (deprecated) Use oCallback.scope.

Returns: `Number`
  Transaction ID.

#### Methods inherited from YAHOO.util.DataSourceBase:

`addToCache, clearAllIntervals, clearInterval, doBeforeCallback, doBeforeParseData, flushCache, getCachedResponse, handleResponse, isCacheHit, makeConnection, parseArrayData, parseData, parseHTMLTableData, parseJSONData, parseTextData, parseXMLData, parseXMLResult, sendRequest, setInterval, toString`

#### Events inherited from YAHOO.util.DataSourceBase:

`cacheFlushEvent, cacheRequestEvent, cacheResponseEvent, dataErrorEvent, requestEvent, responseCacheEvent, responseEvent, responseParseEvent,`

Copyright © 2009 Yahoo! Inc. All rights reserved.