605 lines
29 KiB
HTML
605 lines
29 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>API: autocomplete YAHOO.widget.DS_XHR (YUI Library)</title>
|
|
<link rel="stylesheet" type="text/css" href="assets/api.css">
|
|
</head>
|
|
|
|
<body id="yahoo-com">
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="hd">
|
|
<h1>Yahoo! UI Library</h1>
|
|
<h3>AutoComplete Widget <span class="subtitle">2.2.2</span></h3>
|
|
<p>
|
|
<a href="./index.html">Yahoo! UI Library</a>
|
|
> <a href="./module_autocomplete.html">autocomplete</a>
|
|
> YAHOO.widget.DS_XHR
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
|
|
<h2>
|
|
|
|
|
|
|
|
|
|
Class <b>YAHOO.widget.DS_XHR</b>
|
|
<span class="extends">
|
|
- extends <a href="YAHOO.widget.DataSource.html">YAHOO.widget.DataSource</a>
|
|
</span>
|
|
|
|
<span class="extends">
|
|
</span>
|
|
|
|
</code>
|
|
</h2>
|
|
<!-- class tree goes here -->
|
|
|
|
|
|
|
|
|
|
<div class="summary description">
|
|
Implementation of YAHOO.widget.DataSource using XML HTTP requests that return
|
|
query results.
|
|
</div>
|
|
|
|
<div class="section constructor details">
|
|
<h3><a name="constructor_detail">Constructor</a></h3>
|
|
<div class="content">
|
|
<div class="detail">
|
|
<strong>YAHOO.widget.DS_XHR</strong>
|
|
<code>
|
|
(
|
|
|
|
|
|
|
|
sScriptURI
|
|
|
|
,
|
|
aSchema
|
|
|
|
,
|
|
oConfigs
|
|
)
|
|
</code>
|
|
<div class="description">
|
|
<dl>
|
|
<dt>Parameters:</dt>
|
|
<dd>
|
|
<code>sScriptURI
|
|
<String>
|
|
</code>
|
|
Absolute or relative URI to script that returns query
|
|
results as JSON, XML, or delimited flat-file data.
|
|
</dd>
|
|
<dd>
|
|
<code>aSchema
|
|
<String[]>
|
|
</code>
|
|
Data schema definition of results.
|
|
</dd>
|
|
<dd>
|
|
<code>oConfigs
|
|
<Object>
|
|
</code>
|
|
(optional) Object literal of config params.
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section field details">
|
|
<h3><a name="field_detail">Properties</a></h3>
|
|
<div class="content">
|
|
<h4><a name="_oConn">_oConn</a>
|
|
<code>- private Object</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
XHR connection object.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
<h4><a name="connMgr">connMgr</a>
|
|
<code>- Object</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Alias to YUI Connection Manager. Allows implementers to specify their own
|
|
subclasses of the YUI Connection Manager utility.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: YAHOO.util.Connect
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="connTimeout">connTimeout</a>
|
|
<code>- Number</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Number of milliseconds the XHR connection will wait for a server response. A
|
|
a value of zero indicates the XHR connection will wait forever. Any value
|
|
greater than zero will use the Connection utility's Auto-Abort feature.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: 0
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="ERROR_DATAXHR">ERROR_DATAXHR</a>
|
|
<code>- static final String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Error message for XHR failure.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
<h4><a name="responseStripAfter">responseStripAfter</a>
|
|
<code>- String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
String after which to strip results. If the results from the XHR are sent
|
|
back as HTML, the gzip HTML comment appears at the end of the data and should
|
|
be ignored.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: "\n<!-"
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="responseType">responseType</a>
|
|
<code>- String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
XHR response data type. Other types that may be defined are YAHOO.widget.DS_XHR.TYPE_XML
|
|
and YAHOO.widget.DS_XHR.TYPE_FLAT.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: YAHOO.widget.DS_XHR.TYPE_JSON
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="scriptQueryAppend">scriptQueryAppend</a>
|
|
<code>- String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
String of key/value pairs to append to requests made to scriptURI. Define
|
|
this string when you want to send additional query parameters to your script.
|
|
When defined, queries will be sent to
|
|
<scriptURI>?<scriptQueryParam>=userinput&<scriptQueryAppend>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: ""
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="scriptQueryParam">scriptQueryParam</a>
|
|
<code>- String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Query string parameter name sent to scriptURI. For instance, queries will be
|
|
sent to <scriptURI>?<scriptQueryParam>=userinput
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="default">
|
|
Default Value: "query"
|
|
</div>
|
|
|
|
|
|
<hr />
|
|
<h4><a name="scriptURI">scriptURI</a>
|
|
<code>- String</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Absolute or relative URI to script that returns query results. For instance,
|
|
queries will be sent to <scriptURI>?<scriptQueryParam>=userinput
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
<h4><a name="TYPE_FLAT">TYPE_FLAT</a>
|
|
<code>- static final Number</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
Flat-file data type.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
<h4><a name="TYPE_JSON">TYPE_JSON</a>
|
|
<code>- static final Number</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
JSON data type.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
<h4><a name="TYPE_XML">TYPE_XML</a>
|
|
<code>- static final Number</code>
|
|
</h4>
|
|
<div class="detail">
|
|
<div class="description">
|
|
XML data type.
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section field inheritance">
|
|
<h4>Properties inherited from <a href="YAHOO.widget.DataSource.html">YAHOO.widget.DataSource</a>:</h4>
|
|
<div class="content">
|
|
<code>
|
|
|
|
<a href="YAHOO.widget.DataSource.html#_aCache">_aCache</a>,
|
|
<a href="YAHOO.widget.DataSource.html#_sName">_sName</a>,
|
|
<a href="YAHOO.widget.DataSource.html#maxCacheEntries">maxCacheEntries</a>,
|
|
<a href="YAHOO.widget.DataSource.html#queryMatchCase">queryMatchCase</a>,
|
|
<a href="YAHOO.widget.DataSource.html#queryMatchContains">queryMatchContains</a>,
|
|
<a href="YAHOO.widget.DataSource.html#queryMatchSubset">queryMatchSubset</a>
|
|
</code>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section method details">
|
|
<h3><a name="methodDetails">Methods</a></h3>
|
|
<div class="content">
|
|
<h4>
|
|
<a name="doQuery">doQuery</a></h4>
|
|
<div class="detail">
|
|
<code>
|
|
|
|
|
|
|
|
void
|
|
<strong>doQuery</strong>
|
|
(
|
|
|
|
|
|
oCallbackFn
|
|
|
|
|
|
,
|
|
sQuery
|
|
|
|
|
|
,
|
|
oParent
|
|
|
|
|
|
)
|
|
</code>
|
|
|
|
<div class="description">
|
|
Queries the live data source defined by scriptURI for results. Results are
|
|
passed back to a callback function.
|
|
</div>
|
|
|
|
<div class="description">
|
|
|
|
<dl>
|
|
<dt>Parameters:</dt>
|
|
<dd>
|
|
<code>oCallbackFn <HTMLFunction></code>
|
|
Callback function defined by oParent object to which to return results.
|
|
</dd>
|
|
<dd>
|
|
<code>sQuery <String></code>
|
|
Query string.
|
|
</dd>
|
|
<dd>
|
|
<code>oParent <Object></code>
|
|
The object instance that has requested data.
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl>
|
|
<dt>Returns:
|
|
<code>
|
|
void
|
|
</code></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<hr />
|
|
<h4>
|
|
<a name="parseResponse">parseResponse</a></h4>
|
|
<div class="detail">
|
|
<code>
|
|
|
|
|
|
|
|
void
|
|
<strong>parseResponse</strong>
|
|
(
|
|
|
|
|
|
sQuery
|
|
|
|
|
|
,
|
|
oResponse
|
|
|
|
|
|
,
|
|
oParent
|
|
|
|
|
|
)
|
|
</code>
|
|
|
|
<div class="description">
|
|
Parses raw response data into an array of result objects. The result data key
|
|
is always stashed in the [0] element of each result object.
|
|
</div>
|
|
|
|
<div class="description">
|
|
|
|
<dl>
|
|
<dt>Parameters:</dt>
|
|
<dd>
|
|
<code>sQuery <String></code>
|
|
Query string.
|
|
</dd>
|
|
<dd>
|
|
<code>oResponse <Object></code>
|
|
The raw response data to parse.
|
|
</dd>
|
|
<dd>
|
|
<code>oParent <Object></code>
|
|
The object instance that has requested data.
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl>
|
|
<dt>Returns:
|
|
<code>
|
|
void
|
|
</code></dt>
|
|
<dd></dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<hr />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section field inheritance">
|
|
<h4>Methods inherited from <a href="YAHOO.widget.DataSource.html">YAHOO.widget.DataSource</a>:</h4>
|
|
<div class="content">
|
|
<code>
|
|
|
|
<a href="YAHOO.widget.DataSource.html#_addCacheElem">_addCacheElem</a>,
|
|
<a href="YAHOO.widget.DataSource.html#_doQueryCache">_doQueryCache</a>,
|
|
<a href="YAHOO.widget.DataSource.html#_init">_init</a>,
|
|
<a href="YAHOO.widget.DataSource.html#doQuery">doQuery</a>,
|
|
<a href="YAHOO.widget.DataSource.html#flushCache">flushCache</a>,
|
|
<a href="YAHOO.widget.DataSource.html#getResults">getResults</a>,
|
|
<a href="YAHOO.widget.DataSource.html#toString">toString</a>
|
|
</code>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="section field inheritance">
|
|
<h4>Events inherited from <a href="YAHOO.widget.DataSource.html">YAHOO.widget.DataSource</a>:</h4>
|
|
<div class="content">
|
|
<code>
|
|
|
|
<a href="YAHOO.widget.DataSource.html#cacheFlushEvent">cacheFlushEvent</a>,
|
|
<a href="YAHOO.widget.DataSource.html#cacheQueryEvent">cacheQueryEvent</a>,
|
|
<a href="YAHOO.widget.DataSource.html#dataErrorEvent">dataErrorEvent</a>,
|
|
<a href="YAHOO.widget.DataSource.html#getCachedResultsEvent">getCachedResultsEvent</a>,
|
|
<a href="YAHOO.widget.DataSource.html#getResultsEvent">getResultsEvent</a>,
|
|
<a href="YAHOO.widget.DataSource.html#queryEvent">queryEvent</a>
|
|
</code>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
<div class="nav">
|
|
|
|
<div class="module">
|
|
<h4>Modules</h4>
|
|
<ul class="content">
|
|
|
|
<li class=""><a href="module_animation.html">animation</a></li>
|
|
|
|
<li class="selected"><a href="module_autocomplete.html">autocomplete</a></li>
|
|
|
|
<li class=""><a href="module_button.html">button</a></li>
|
|
|
|
<li class=""><a href="module_calendar.html">calendar</a></li>
|
|
|
|
<li class=""><a href="module_connection.html">connection</a></li>
|
|
|
|
<li class=""><a href="module_container.html">container</a></li>
|
|
|
|
<li class=""><a href="module_datasource.html">datasource</a></li>
|
|
|
|
<li class=""><a href="module_datatable.html">datatable</a></li>
|
|
|
|
<li class=""><a href="module_dom.html">dom</a></li>
|
|
|
|
<li class=""><a href="module_dragdrop.html">dragdrop</a></li>
|
|
|
|
<li class=""><a href="module_element.html">element</a></li>
|
|
|
|
<li class=""><a href="module_event.html">event</a></li>
|
|
|
|
<li class=""><a href="module_history.html">history</a></li>
|
|
|
|
<li class=""><a href="module_logger.html">logger</a></li>
|
|
|
|
<li class=""><a href="module_menu.html">menu</a></li>
|
|
|
|
<li class=""><a href="module_slider.html">slider</a></li>
|
|
|
|
<li class=""><a href="module_tabview.html">tabview</a></li>
|
|
|
|
<li class=""><a href="module_treeview.html">treeview</a></li>
|
|
|
|
<li class=""><a href="module_yahoo.html">yahoo</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Classes</h4>
|
|
<ul class="content">
|
|
<li class=""><a href="YAHOO.widget.AutoComplete.html">YAHOO.widget.AutoComplete</a></li>
|
|
<li class=""><a href="YAHOO.widget.DataSource.html">YAHOO.widget.DataSource</a></li>
|
|
<li class=""><a href="YAHOO.widget.DS_JSArray.html">YAHOO.widget.DS_JSArray</a></li>
|
|
<li class=""><a href="YAHOO.widget.DS_JSFunction.html">YAHOO.widget.DS_JSFunction</a></li>
|
|
<li class="selected"><a href="YAHOO.widget.DS_XHR.html">YAHOO.widget.DS_XHR</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Files</h4>
|
|
<ul class="content">
|
|
<li class=""><a href="AutoComplete.js.html">AutoComplete.js</a></li>
|
|
<li class=""><a href="DataSource.js.html">DataSource.js</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Properties</h4>
|
|
<ul class="content">
|
|
<li><a href="#_oConn">_oConn</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#connMgr">connMgr</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#connTimeout">connTimeout</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#ERROR_DATAXHR">ERROR_DATAXHR</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#responseStripAfter">responseStripAfter</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#responseType">responseType</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#scriptQueryAppend">scriptQueryAppend</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#scriptQueryParam">scriptQueryParam</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#scriptURI">scriptURI</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#TYPE_FLAT">TYPE_FLAT</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#TYPE_JSON">TYPE_JSON</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
<li><a href="#TYPE_XML">TYPE_XML</a>
|
|
<!--<code><Number></code>-->
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Methods</h4>
|
|
<ul class="content">
|
|
<li><!--<code>void</code>-->
|
|
<a href="#doQuery">doQuery</a>
|
|
</li>
|
|
<li><!--<code>void</code>-->
|
|
<a href="#parseResponse">parseResponse</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="ft">
|
|
<hr />
|
|
Copyright © 2007 Yahoo! Inc. All rights reserved.
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|