Class YAHOO.widget.DS_JSFunction
Implementation of YAHOO.widget.DataSource using a native Javascript function as
its live data source.
Public Properties
|
ERROR_DATANULL : String |
DataSource |
<static> Error message for null data responses. |
|
ERROR_DATAPARSE : String |
DataSource |
<static> Error message for data responses with parsing errors. |
|
dataFunction : HTMLFunction |
DS_JSFunction |
In-memory Javascript function that returns query results. |
|
maxCacheEntries : Number |
DataSource |
Max size of the local cache. Set to 0 to turn off caching. Caching is
useful to reduce the number of server connect... |
|
queryMatchCase : Boolean |
DataSource |
Enables query case-sensitivity matching. If caching is on and
queryMatchCase is true, queries will only return result... |
|
queryMatchContains : Boolean |
DataSource |
Use this to equate cache matching with the type of matching done by your live
data source. If caching is on and query... |
|
queryMatchSubset : Boolean |
DataSource |
Enables query subset matching. If caching is on and queryMatchSubset is
true, substrings of queries will return match... |
Public Methods
|
DS_JSFunction(oFunction {String} , [oConfigs {Object} ]) |
DS_JSFunction |
|
|
doQuery(oCallbackFn {HTMLFunction} , sQuery {String} , oParent {Object} ) : void |
DS_JSFunction |
Queries the live data source defined by function for results. Results are
passed back to a callback function. |
|
flushCache() : void |
DataSource |
Flushes cache. |
|
getResults(oCallbackFn {HTMLFunction} , sQuery {String} , oParent {Object} ) : void |
DataSource |
Retrieves query results, first checking the local cache, then making the
query request to the live data source as def... |
|
toString() : String |
DataSource |
Public accessor to the unique name of the DataSource instance. |
Public Events
|
cacheFlushEvent : (oSelf {Object} ) |
DataSource |
Fired when the local cache is flushed. |
|
cacheQueryEvent : (oSelf {Object} , oParent {Object} , sQuery {String} ) |
DataSource |
Fired when a query is made to the local cache. |
|
dataErrorEvent : (oSelf {Object} , oParent {Object} , sQuery {String} , sMsg {String} ) |
DataSource |
Fired when an error is encountered with the live data source. |
|
getCachedResultsEvent : (oSelf {Object} , oParent {Object} , sQuery {String} , aResults {Object[]} ) |
DataSource |
Fired when data is retrieved from the local cache. |
|
getResultsEvent : (oSelf {Object} , oParent {Object} , sQuery {String} , aResults {Object[]} ) |
DataSource |
Fired when data is retrieved from the live data source. |
|
queryEvent : (oSelf {Object} , oParent {Object} , sQuery {String} ) |
DataSource |
Fired when a query is made to the live data source. |
Property Details
ERROR_DATANULL
public String ERROR_DATANULL
<static> Error message for null data responses.
ERROR_DATAPARSE
public String ERROR_DATAPARSE
<static> Error message for data responses with parsing errors.
dataFunction
public HTMLFunction dataFunction
In-memory Javascript function that returns query results.
This property is defined by DS_JSFunction.
maxCacheEntries
public Number maxCacheEntries
Max size of the local cache. Set to 0 to turn off caching. Caching is
useful to reduce the number of server connections. Recommended only for data
sources that return comprehensive results for queries or when stale data is
not an issue.
queryMatchCase
public Boolean queryMatchCase
Enables query case-sensitivity matching. If caching is on and
queryMatchCase is true, queries will only return results for case-sensitive
matches.
queryMatchContains
public Boolean queryMatchContains
Use this to equate cache matching with the type of matching done by your live
data source. If caching is on and queryMatchContains is true, the cache
returns results that "contain" the query string. By default,
queryMatchContains is set to false, meaning the cache only returns results
that "start with" the query string.
queryMatchSubset
public Boolean queryMatchSubset
Enables query subset matching. If caching is on and queryMatchSubset is
true, substrings of queries will return matching cached results. For
instance, if the first query is for "abc" susequent queries that start with
"abc", like "abcd", will be queried against the cache, and not the live data
source. Recommended only for DataSources that return comprehensive results
for queries with very few characters.
Constructor Details
DS_JSFunction
public function DS_JSFunction(oFunction {String}
, [oConfigs {Object}
])
Method Details
doQuery
public function doQuery(oCallbackFn {HTMLFunction}
, sQuery {String}
, oParent {Object}
)
Queries the live data source defined by function for results. Results are
passed back to a callback function.
This method is defined by DS_JSFunction.
flushCache
public function flushCache()
getResults
public function getResults(oCallbackFn {HTMLFunction}
, sQuery {String}
, oParent {Object}
)
Retrieves query results, first checking the local cache, then making the
query request to the live data source as defined by the function doQuery.
toString
public function toString()
Public accessor to the unique name of the DataSource instance.
Event Details
cacheFlushEvent
public event cacheFlushEvent
Fired when the local cache is flushed.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance
cacheQueryEvent
public event cacheQueryEvent
Fired when a query is made to the local cache.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance.
{Object}
: oParentThe requesting object.
{String}
: sQueryThe query string.
dataErrorEvent
public event dataErrorEvent
Fired when an error is encountered with the live data source.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance.
{Object}
: oParentThe requesting object.
{String}
: sQueryThe query string.
{String}
: sMsgError message string
getCachedResultsEvent
public event getCachedResultsEvent
Fired when data is retrieved from the local cache.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance.
{Object}
: oParentThe requesting object.
{String}
: sQueryThe query string.
{Object[]}
: aResultsArray of result objects.
getResultsEvent
public event getResultsEvent
Fired when data is retrieved from the live data source.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance.
{Object}
: oParentThe requesting object.
{String}
: sQueryThe query string.
{Object[]}
: aResultsArray of result objects.
queryEvent
public event queryEvent
Fired when a query is made to the live data source.
Subscribers will be called with the following parameters:
{Object}
: oSelfThe DataSource instance.
{Object}
: oParentThe requesting object.
{String}
: sQueryThe query string.
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.