source: trunk/web/addons/job_monarch/lib/extjs/docs/output/Ext.data.Connection.html @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 40.8 KB
Line 
1        <div class="body-wrap">
2        <div class="top-tools">
3            <a class="inner-link" href="#Ext.data.Connection-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4            <a class="inner-link" href="#Ext.data.Connection-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5            <a class="inner-link" href="#Ext.data.Connection-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                            <a class="inner-link" href="#Ext.data.Connection-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
7                        <a class="bookmark" href="../docs/?class=Ext.data.Connection"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
8        </div>
9                <div class="inheritance res-block">
10<pre class="res-block-inner"><a ext:cls="Ext.util.Observable" ext:member="" href="output/Ext.util.Observable.html">Observable</a>
11  <img src="resources/elbow-end.gif"/>Connection</pre></div>
12                <h1>Class Ext.data.Connection</h1>
13        <table cellspacing="0">
14            <tr><td class="label">Package:</td><td class="hd-info">Ext.data</td></tr>
15            <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/Connection.js" target="_blank">Connection.js</a></td></tr>
16            <tr><td class="label">Class:</td><td class="hd-info">Connection</td></tr>
17                        <tr><td class="label">Subclasses:</td><td class="hd-info"><a ext:cls="Ext.Ajax" href="output/Ext.Ajax.html">Ajax</a></td></tr>
18                                    <tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.util.Observable" ext:member="" href="output/Ext.util.Observable.html">Observable</a></td></tr>
19                    </table>
20        <div class="description">
21            *
22<p>The class encapsulates a connection to the page's originating domain, allowing requests to be made
23either to a configured URL, or to a URL specified at request time.</p>
24<p>Requests made by this class are asynchronous, and will return immediately. No data from
25the server will be available to the statement immediately following the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> call.
26To process returned data, use a
27<a href="#request-option-success" ext:member="request-option-success" ext:cls="Ext.data.Connection">success callback</a>
28in the request options object,
29or an <a ext:cls="Ext.data.Connection" ext:member="requestcomplete" href="output/Ext.data.Connection.html#requestcomplete">event listener</a>.</p>
30<p><h3>File Uploads</h3><a href="#request-option-isUpload" ext:member="request-option-isUpload" ext:cls="Ext.data.Connection">File uploads</a> are not performed using normal "Ajax" techniques, that
31is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
32manner with the DOM <tt>&lt;form></tt> element temporarily modified to have its
33<a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
34to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
35but removed after the return data has been gathered.</p>
36<p>The server response is parsed by the browser to create the document for the IFRAME. If the
37server is using JSON to send the return object, then the
38<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
39must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
40<p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
41"&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
42<p>The response text is retrieved from the document, and a fake XMLHttpRequest object
43is created containing a <tt>responseText</tt> property in order to conform to the
44requirements of event handlers and callbacks.</p>
45<p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
46and some server technologies (notably JEE) may require some custom processing in order to
47retrieve parameter names and parameter values from the packet content.</p>        </div>
48       
49        <div class="hr"></div>
50                <a id="Ext.data.Connection-configs"></a>
51        <h2>Config Options</h2>
52        <table cellspacing="0" class="member-table">
53            <tr>
54                <th class="sig-header" colspan="2">Config Options</th>
55                <th class="msource-header">Defined By</th>
56            </tr>
57                <tr class="config-row">
58        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
59        <td class="sig">
60        <a id="Ext.data.Connection-autoAbort"></a>
61            <b>autoAbort</b> : Boolean            <div class="mdesc">
62                            (Optional) Whether this request should abort any pending requests. (defaults to false)                        </div>
63        </td>
64        <td class="msource">Connection</td>
65    </tr>
66        <tr class="config-row alt expandable">
67        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
68        <td class="sig">
69        <a id="Ext.data.Connection-defaultHeaders"></a>
70            <b>defaultHeaders</b> : Object            <div class="mdesc">
71                        <div class="short">(Optional) An object containing request headers which are added to each request made by this object. (defaults to und...</div>
72            <div class="long">
73                (Optional) An object containing request headers which are added to each request made by this object. (defaults to undefined)            </div>
74                        </div>
75        </td>
76        <td class="msource">Connection</td>
77    </tr>
78        <tr class="config-row">
79        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
80        <td class="sig">
81        <a id="Ext.data.Connection-disableCaching"></a>
82            <b>disableCaching</b> : Boolean            <div class="mdesc">
83                            (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)                        </div>
84        </td>
85        <td class="msource">Connection</td>
86    </tr>
87        <tr class="config-row alt">
88        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
89        <td class="sig">
90        <a id="Ext.data.Connection-disableCachingParam"></a>
91            <b>disableCachingParam</b> : String            <div class="mdesc">
92                            (Optional) Change the parameter which is sent went disabling caching through a cache buster. Defaults to '_dc'                        </div>
93        </td>
94        <td class="msource">Connection</td>
95    </tr>
96        <tr class="config-row expandable">
97        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
98        <td class="sig">
99        <a id="Ext.data.Connection-extraParams"></a>
100            <b>extraParams</b> : Object            <div class="mdesc">
101                        <div class="short">(Optional) An object containing properties which are used as extra parameters to each request made by this object. (d...</div>
102            <div class="long">
103                (Optional) An object containing properties which are used as extra parameters to each request made by this object. (defaults to undefined)            </div>
104                        </div>
105        </td>
106        <td class="msource">Connection</td>
107    </tr>
108        <tr class="config-row inherited alt expandable">
109        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
110        <td class="sig">
111        <a id="Ext.data.Connection-listeners"></a>
112            <b>listeners</b> : Object            <div class="mdesc">
113                        <div class="short">(optional) A config object containing one or more event handlers to be added to this object during initialization. Th...</div>
114            <div class="long">
115                (optional) A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the <a ext:cls="Ext.util.Observable" ext:member="addListener" href="output/Ext.util.Observable.html#addListener">addListener</a> example for attaching multiple handlers at once.            </div>
116                        </div>
117        </td>
118        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#listeners" href="output/Ext.util.Observable.html#listeners">Observable</a></td>
119    </tr>
120        <tr class="config-row expandable">
121        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
122        <td class="sig">
123        <a id="Ext.data.Connection-method"></a>
124            <b>method</b> : String            <div class="mdesc">
125                        <div class="short">(Optional) The default HTTP method to be used for requests. (defaults to undefined; if not set, but request params ar...</div>
126            <div class="long">
127                (Optional) The default HTTP method to be used for requests. (defaults to undefined; if not set, but <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> params are present, POST will be used; otherwise, GET will be used.)            </div>
128                        </div>
129        </td>
130        <td class="msource">Connection</td>
131    </tr>
132        <tr class="config-row alt">
133        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
134        <td class="sig">
135        <a id="Ext.data.Connection-timeout"></a>
136            <b>timeout</b> : Number            <div class="mdesc">
137                            (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)                        </div>
138        </td>
139        <td class="msource">Connection</td>
140    </tr>
141        <tr class="config-row">
142        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
143        <td class="sig">
144        <a id="Ext.data.Connection-url"></a>
145            <b>url</b> : String            <div class="mdesc">
146                            (Optional) The default URL to be used for requests to the server. (defaults to undefined)                        </div>
147        </td>
148        <td class="msource">Connection</td>
149    </tr>
150            </table>
151                <a id="Ext.data.Connection-props"></a>
152        <h2>Public Properties</h2>
153        <div class="no-members">This class has no public properties.</div>        <a id="Ext.data.Connection-methods"></a>
154        <h2>Public Methods</h2>
155                <table cellspacing="0" class="member-table">
156            <tr>
157                <th class="sig-header" colspan="2">Method</th>
158                <th class="msource-header">Defined By</th>
159            </tr>
160                <tr class="method-row expandable">
161        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
162        <td class="sig">
163        <a id="Ext.data.Connection-Connection"></a>
164            <b>Connection</b>(&nbsp;<code>Object config</code>&nbsp;)            <div class="mdesc">
165                        <div class="short"></div>
166            <div class="long">
167                    <div class="mdetail-params">
168        <strong>Parameters:</strong>
169        <ul><li><code>config</code> : Object<div class="sub-desc">a configuration object.</div></li>        </ul>
170        <strong>Returns:</strong>
171        <ul>
172            <li><code></code></li>
173        </ul>
174    </div>
175                </div>
176                        </div>
177        </td>
178        <td class="msource">Connection</td>
179    </tr>
180        <tr class="method-row alt expandable">
181        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
182        <td class="sig">
183        <a id="Ext.data.Connection-abort"></a>
184            <b>abort</b>(&nbsp;<span class="optional" title="Optional">[<code>Number transactionId</code>]</span>&nbsp;) : void            <div class="mdesc">
185                        <div class="short">Aborts any outstanding request.</div>
186            <div class="long">
187                Aborts any outstanding request.    <div class="mdetail-params">
188        <strong>Parameters:</strong>
189        <ul><li><code>transactionId</code> : Number<div class="sub-desc">(Optional) defaults to the last transaction</div></li>        </ul>
190        <strong>Returns:</strong>
191        <ul>
192            <li><code>void</code></li>
193        </ul>
194    </div>
195                </div>
196                        </div>
197        </td>
198        <td class="msource">Connection</td>
199    </tr>
200        <tr class="method-row inherited expandable">
201        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
202        <td class="sig">
203        <a id="Ext.data.Connection-addEvents"></a>
204            <b>addEvents</b>(&nbsp;<code>Object object</code>&nbsp;) : void            <div class="mdesc">
205                        <div class="short">Used to define events on this Observable</div>
206            <div class="long">
207                Used to define events on this Observable    <div class="mdetail-params">
208        <strong>Parameters:</strong>
209        <ul><li><code>object</code> : Object<div class="sub-desc">The object with the events defined</div></li>        </ul>
210        <strong>Returns:</strong>
211        <ul>
212            <li><code>void</code></li>
213        </ul>
214    </div>
215                </div>
216                        </div>
217        </td>
218        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#addEvents" href="output/Ext.util.Observable.html#addEvents">Observable</a></td>
219    </tr>
220        <tr class="method-row inherited alt expandable">
221        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
222        <td class="sig">
223        <a id="Ext.data.Connection-addListener"></a>
224            <b>addListener</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : void            <div class="mdesc">
225                        <div class="short">Appends an event handler to this component</div>
226            <div class="long">
227                Appends an event handler to this component    <div class="mdetail-params">
228        <strong>Parameters:</strong>
229        <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the handler
230function. The handler function's "this" context.</div></li><li><code>options</code> : Object<div class="sub-desc">(optional) An object containing handler configuration
231properties. This may contain any of the following properties:<ul>
232<li><b>scope</b> : Object<p class="sub-desc">The scope in which to execute the handler function. The handler function's "this" context.</p></li>
233<li><b>delay</b> : Number<p class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</p></li>
234<li><b>single</b> : Boolean<p class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</p></li>
235<li><b>buffer</b> : Number<p class="sub-desc">Causes the handler to be scheduled to run in an <a ext:cls="Ext.util.DelayedTask" href="output/Ext.util.DelayedTask.html">Ext.util.DelayedTask</a> delayed
236by the specified number of milliseconds. If the event fires again within that time, the original
237handler is <em>not</em> invoked, but the new handler is scheduled in its place.</p></li>
238</ul><br>
239<p>
240<b>Combining Options</b><br>
241Using the options argument, it is possible to combine different types of listeners:<br>
242<br>
243A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
244<pre><code>el.on(<em>'click'</em>, <b>this</b>.onClick, <b>this</b>, {
245    single: true,
246    delay: 100,
247    forumId: 4
248});</code></pre>
249<p>
250<b>Attaching multiple handlers in 1 call</b><br>
251The method also allows for a single argument to be passed which is a config object containing properties
252which specify multiple handlers.
253<p>
254<pre><code>foo.on({
255    <em>'click'</em> : {
256        fn: <b>this</b>.onClick,
257        scope: <b>this</b>,
258        delay: 100
259    },
260    <em>'mouseover'</em> : {
261        fn: <b>this</b>.onMouseOver,
262        scope: <b>this</b>
263    },
264    <em>'mouseout'</em> : {
265        fn: <b>this</b>.onMouseOut,
266        scope: <b>this</b>
267    }
268});</code></pre>
269<p>
270Or a shorthand syntax:<br>
271<pre><code>foo.on({
272    <em>'click'</em> : <b>this</b>.onClick,
273    <em>'mouseover'</em> : <b>this</b>.onMouseOver,
274    <em>'mouseout'</em> : <b>this</b>.onMouseOut,
275     scope: <b>this</b>
276});</code></pre></div></li>        </ul>
277        <strong>Returns:</strong>
278        <ul>
279            <li><code>void</code></li>
280        </ul>
281    </div>
282                </div>
283                        </div>
284        </td>
285        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#addListener" href="output/Ext.util.Observable.html#addListener">Observable</a></td>
286    </tr>
287        <tr class="method-row inherited expandable">
288        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
289        <td class="sig">
290        <a id="Ext.data.Connection-fireEvent"></a>
291            <b>fireEvent</b>(&nbsp;<code>String eventName</code>, <code>Object... args</code>&nbsp;) : Boolean            <div class="mdesc">
292                        <div class="short">Fires the specified event with the passed parameters (minus the event name).</div>
293            <div class="long">
294                Fires the specified event with the passed parameters (minus the event name).    <div class="mdetail-params">
295        <strong>Parameters:</strong>
296        <ul><li><code>eventName</code> : String<div class="sub-desc"></div></li><li><code>args</code> : Object...<div class="sub-desc">Variable number of parameters are passed to handlers</div></li>        </ul>
297        <strong>Returns:</strong>
298        <ul>
299            <li><code>Boolean</code><div class="sub-desc">returns false if any of the handlers return false otherwise it returns true</div></li>
300        </ul>
301    </div>
302                </div>
303                        </div>
304        </td>
305        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#fireEvent" href="output/Ext.util.Observable.html#fireEvent">Observable</a></td>
306    </tr>
307        <tr class="method-row inherited alt expandable">
308        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
309        <td class="sig">
310        <a id="Ext.data.Connection-hasListener"></a>
311            <b>hasListener</b>(&nbsp;<code>String eventName</code>&nbsp;) : Boolean            <div class="mdesc">
312                        <div class="short">Checks to see if this object has any listeners for a specified event</div>
313            <div class="long">
314                Checks to see if this object has any listeners for a specified event    <div class="mdetail-params">
315        <strong>Parameters:</strong>
316        <ul><li><code>eventName</code> : String<div class="sub-desc">The name of the event to check for</div></li>        </ul>
317        <strong>Returns:</strong>
318        <ul>
319            <li><code>Boolean</code><div class="sub-desc">True if the event is being listened for, else false</div></li>
320        </ul>
321    </div>
322                </div>
323                        </div>
324        </td>
325        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#hasListener" href="output/Ext.util.Observable.html#hasListener">Observable</a></td>
326    </tr>
327        <tr class="method-row expandable">
328        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
329        <td class="sig">
330        <a id="Ext.data.Connection-isLoading"></a>
331            <b>isLoading</b>(&nbsp;<span class="optional" title="Optional">[<code>Number transactionId</code>]</span>&nbsp;) : Boolean            <div class="mdesc">
332                        <div class="short">Determine whether this object has a request outstanding.</div>
333            <div class="long">
334                Determine whether this object has a request outstanding.    <div class="mdetail-params">
335        <strong>Parameters:</strong>
336        <ul><li><code>transactionId</code> : Number<div class="sub-desc">(Optional) defaults to the last transaction</div></li>        </ul>
337        <strong>Returns:</strong>
338        <ul>
339            <li><code>Boolean</code><div class="sub-desc">True if there is an outstanding request.</div></li>
340        </ul>
341    </div>
342                </div>
343                        </div>
344        </td>
345        <td class="msource">Connection</td>
346    </tr>
347        <tr class="method-row inherited alt expandable">
348        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
349        <td class="sig">
350        <a id="Ext.data.Connection-on"></a>
351            <b>on</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : void            <div class="mdesc">
352                        <div class="short">Appends an event handler to this element (shorthand for addListener)</div>
353            <div class="long">
354                Appends an event handler to this element (shorthand for addListener)    <div class="mdetail-params">
355        <strong>Parameters:</strong>
356        <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the handler
357function. The handler function's "this" context.</div></li><li><code>options</code> : Object<div class="sub-desc">(optional)</div></li>        </ul>
358        <strong>Returns:</strong>
359        <ul>
360            <li><code>void</code></li>
361        </ul>
362    </div>
363                </div>
364                        </div>
365        </td>
366        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#on" href="output/Ext.util.Observable.html#on">Observable</a></td>
367    </tr>
368        <tr class="method-row inherited expandable">
369        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
370        <td class="sig">
371        <a id="Ext.data.Connection-purgeListeners"></a>
372            <b>purgeListeners</b>() : void            <div class="mdesc">
373                        <div class="short">Removes all listeners for this object</div>
374            <div class="long">
375                Removes all listeners for this object    <div class="mdetail-params">
376        <strong>Parameters:</strong>
377        <ul><li>None.</li>        </ul>
378        <strong>Returns:</strong>
379        <ul>
380            <li><code>void</code></li>
381        </ul>
382    </div>
383                </div>
384                        </div>
385        </td>
386        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#purgeListeners" href="output/Ext.util.Observable.html#purgeListeners">Observable</a></td>
387    </tr>
388        <tr class="method-row inherited alt expandable">
389        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
390        <td class="sig">
391        <a id="Ext.data.Connection-relayEvents"></a>
392            <b>relayEvents</b>(&nbsp;<code>Object o</code>, <code>Array events</code>&nbsp;) : void            <div class="mdesc">
393                        <div class="short">Relays selected events from the specified Observable as if the events were fired by <tt><b>this</b></tt>.</div>
394            <div class="long">
395                Relays selected events from the specified Observable as if the events were fired by <tt><b>this</b></tt>.    <div class="mdetail-params">
396        <strong>Parameters:</strong>
397        <ul><li><code>o</code> : Object<div class="sub-desc">The Observable whose events this object is to relay.</div></li><li><code>events</code> : Array<div class="sub-desc">Array of event names to relay.</div></li>        </ul>
398        <strong>Returns:</strong>
399        <ul>
400            <li><code>void</code></li>
401        </ul>
402    </div>
403                </div>
404                        </div>
405        </td>
406        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#relayEvents" href="output/Ext.util.Observable.html#relayEvents">Observable</a></td>
407    </tr>
408        <tr class="method-row inherited expandable">
409        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
410        <td class="sig">
411        <a id="Ext.data.Connection-removeListener"></a>
412            <b>removeListener</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>&nbsp;) : void            <div class="mdesc">
413                        <div class="short">Removes a listener</div>
414            <div class="long">
415                Removes a listener    <div class="mdetail-params">
416        <strong>Parameters:</strong>
417        <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li>        </ul>
418        <strong>Returns:</strong>
419        <ul>
420            <li><code>void</code></li>
421        </ul>
422    </div>
423                </div>
424                        </div>
425        </td>
426        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#removeListener" href="output/Ext.util.Observable.html#removeListener">Observable</a></td>
427    </tr>
428        <tr class="method-row alt expandable">
429        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
430        <td class="sig">
431        <a id="Ext.data.Connection-request"></a>
432            <b>request</b>(&nbsp;<span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : Number            <div class="mdesc">
433                        <div class="short">Sends an HTTP request to a remote server.
434Important: Ajax server requests are asynchronous, and this call will
435return...</div>
436            <div class="long">
437                <p>Sends an HTTP request to a remote server.</p>
438<p><b>Important:</b> Ajax server requests are asynchronous, and this call will
439return before the response has been received. Process any returned data
440in a callback function.</p>
441<p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>    <div class="mdetail-params">
442        <strong>Parameters:</strong>
443        <ul><li><code>options</code> : Object<div class="sub-desc">An object which may contain the following properties:<ul>
444<li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
445which to send the request, or a function to call which returns a URL string. The scope of the
446function is specified by the <tt>scope</tt> option. Defaults to configured URL.</div></li>
447<li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
448An object containing properties which are used as parameters to the
449request, a url encoded string or a function to call to get either. The scope of the function
450is specified by the <tt>scope</tt> option.</div></li>
451<li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
452for the request. Defaults to the configured method, or if no method was configured,
453"GET" if no parameters are being sent, and "POST" if parameters are being sent. Note that
454the method name is case-sensitive and should be all caps.</div></li>
455<li><b>callback</b> : Function (Optional)<div class="sub-desc">The
456function to be called upon receipt of the HTTP response. The callback is
457called regardless of success or failure and is passed the following
458parameters:<ul>
459<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
460<li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
461<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.
462See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about
463accessing elements of the response.</div></li>
464</ul></div></li>
465<li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function
466to be called upon success of the request. The callback is passed the following
467parameters:<ul>
468<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
469<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
470</ul></div></li>
471<li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
472to be called upon failure of the request. The callback is passed the
473following parameters:<ul>
474<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
475<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
476</ul></div></li>
477<li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
478which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
479specified as functions from which to draw values, then this also serves as the scope for those function calls.
480Defaults to the browser window.</div></li>
481<li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>
482Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>
483<li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used
484with the <tt>form</tt> option.</b>
485<p>True if the form object is a file upload (will be set automatically if the form was
486configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>
487<p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
488performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
489DOM <tt>&lt;form></tt> element temporarily modified to have its
490<a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
491to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
492but removed after the return data has been gathered.</p>
493<p>The server response is parsed by the browser to create the document for the IFRAME. If the
494server is using JSON to send the return object, then the
495<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
496must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
497<p>The response text is retrieved from the document, and a fake XMLHttpRequest object
498is created containing a <tt>responseText</tt> property in order to conform to the
499requirements of event handlers and callbacks.</p>
500<p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
501and some server technologies (notably JEE) may require some custom processing in order to
502retrieve parameter names and parameter values from the packet content.</p>
503</div></li>
504<li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
505headers to set for the request.</div></li>
506<li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
507to use for the post. Note: This will be used instead of params for the post
508data. Any params will be appended to the URL.</div></li>
509<li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
510data to use as the post. Note: This will be used instead of params for the post
511data. Any params will be appended to the URL.</div></li>
512<li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
513to add a unique cache-buster param to GET requests.</div></li>
514</ul></p>
515<p>The options object may also contain any other property which might be needed to perform
516postprocessing in a callback because it is passed to callback functions.</p></div></li>        </ul>
517        <strong>Returns:</strong>
518        <ul>
519            <li><code>Number</code><div class="sub-desc">transactionId The id of the server transaction. This may be used to cancel the request.</div></li>
520        </ul>
521    </div>
522                </div>
523                        </div>
524        </td>
525        <td class="msource">Connection</td>
526    </tr>
527        <tr class="method-row inherited expandable">
528        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
529        <td class="sig">
530        <a id="Ext.data.Connection-resumeEvents"></a>
531            <b>resumeEvents</b>() : void            <div class="mdesc">
532                        <div class="short">Resume firing events. (see <a ext:cls="Ext.util.Observable" ext:member="suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">suspendEvents</a>)</div>
533            <div class="long">
534                Resume firing events. (see <a ext:cls="Ext.util.Observable" ext:member="suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">suspendEvents</a>)    <div class="mdetail-params">
535        <strong>Parameters:</strong>
536        <ul><li>None.</li>        </ul>
537        <strong>Returns:</strong>
538        <ul>
539            <li><code>void</code></li>
540        </ul>
541    </div>
542                </div>
543                        </div>
544        </td>
545        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">Observable</a></td>
546    </tr>
547        <tr class="method-row inherited alt expandable">
548        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
549        <td class="sig">
550        <a id="Ext.data.Connection-suspendEvents"></a>
551            <b>suspendEvents</b>() : void            <div class="mdesc">
552                        <div class="short">Suspend the firing of all events. (see <a ext:cls="Ext.util.Observable" ext:member="resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">resumeEvents</a>)</div>
553            <div class="long">
554                Suspend the firing of all events. (see <a ext:cls="Ext.util.Observable" ext:member="resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">resumeEvents</a>)    <div class="mdetail-params">
555        <strong>Parameters:</strong>
556        <ul><li>None.</li>        </ul>
557        <strong>Returns:</strong>
558        <ul>
559            <li><code>void</code></li>
560        </ul>
561    </div>
562                </div>
563                        </div>
564        </td>
565        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">Observable</a></td>
566    </tr>
567        <tr class="method-row inherited expandable">
568        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
569        <td class="sig">
570        <a id="Ext.data.Connection-un"></a>
571            <b>un</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>&nbsp;) : void            <div class="mdesc">
572                        <div class="short">Removes a listener (shorthand for removeListener)</div>
573            <div class="long">
574                Removes a listener (shorthand for removeListener)    <div class="mdetail-params">
575        <strong>Parameters:</strong>
576        <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li>        </ul>
577        <strong>Returns:</strong>
578        <ul>
579            <li><code>void</code></li>
580        </ul>
581    </div>
582                </div>
583                        </div>
584        </td>
585        <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#un" href="output/Ext.util.Observable.html#un">Observable</a></td>
586    </tr>
587            </table>
588                <a id="Ext.data.Connection-events"></a>
589        <h2>Public Events</h2>
590                <table cellspacing="0" class="member-table">
591            <tr>
592                <th class="sig-header" colspan="2">Event</th>
593                <th class="msource-header">Defined By</th>
594            </tr>
595                <tr class="event-row expandable">
596        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
597        <td class="sig">
598        <a id="Ext.data.Connection-beforerequest"></a>
599            <b>beforerequest</b> : (&nbsp;<code>Connection conn</code>, <code>Object options</code>&nbsp;)            <div class="mdesc">
600                        <div class="short">Fires before a network request is made to retrieve a data object.</div>
601            <div class="long">
602                Fires before a network request is made to retrieve a data object.    <div class="mdetail-params">
603        <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
604        <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li>        </ul>
605    </div>
606                </div>
607                        </div>
608        </td>
609        <td class="msource">Connection</td>
610    </tr>
611        <tr class="event-row alt expandable">
612        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
613        <td class="sig">
614        <a id="Ext.data.Connection-requestcomplete"></a>
615            <b>requestcomplete</b> : (&nbsp;<code>Connection conn</code>, <code>Object response</code>, <code>Object options</code>&nbsp;)            <div class="mdesc">
616                        <div class="short">Fires if the request was successfully completed.</div>
617            <div class="long">
618                Fires if the request was successfully completed.    <div class="mdetail-params">
619        <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
620        <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>response</code> : Object<div class="sub-desc">The XHR object containing the response data.
621See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
622for details.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li>        </ul>
623    </div>
624                </div>
625                        </div>
626        </td>
627        <td class="msource">Connection</td>
628    </tr>
629        <tr class="event-row expandable">
630        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
631        <td class="sig">
632        <a id="Ext.data.Connection-requestexception"></a>
633            <b>requestexception</b> : (&nbsp;<code>Connection conn</code>, <code>Object response</code>, <code>Object options</code>&nbsp;)            <div class="mdesc">
634                        <div class="short">Fires if an error HTTP status was returned from the server.
635See HTTP Status Code Definitions
636for details of HTTP stat...</div>
637            <div class="long">
638                Fires if an error HTTP status was returned from the server.
639See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
640for details of HTTP status codes.    <div class="mdetail-params">
641        <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
642        <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>response</code> : Object<div class="sub-desc">The XHR object containing the response data.
643See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
644for details.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li>        </ul>
645    </div>
646                </div>
647                        </div>
648        </td>
649        <td class="msource">Connection</td>
650    </tr>
651            </table>
652       
653        </div>
Note: See TracBrowser for help on using the repository browser.