📄 ext.updater.html
字号:
<div class="long"> Display the element's "loading" state. By default, the element is updated with <a ext:cls="Ext.Updater" ext:member="indicatorText" href="output/Ext.Updater.html#indicatorText">indicatorText</a>. Thismethod may be overridden to perform a custom action while this Updater is actively updating its contents. <div class="mdetail-params"> <strong>Parameters:</strong> <ul><li>None.</li> </ul> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> <tr class="method-row expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-startAutoRefresh"></a> <b>startAutoRefresh</b>( <code>Number interval</code>, <span class="optional" title="Optional">[<code>String/Object/Function url</code>]</span>, <span class="optional" title="Optional">[<code>String/Object params</code>]</span>, <span class="optional" title="Optional">[<code>Function callback</code>]</span>, <span class="optional" title="Optional">[<code>Boolean refreshNow</code>]</span> ) : void <div class="mdesc"> <div class="short">Set this element to auto refresh. Can be canceled by calling <a ext:cls="Ext.Updater" ext:member="stopAutoRefresh" href="output/Ext.Updater.html#stopAutoRefresh">stopAutoRefresh</a>.</div> <div class="long"> Set this element to auto refresh. Can be canceled by calling <a ext:cls="Ext.Updater" ext:member="stopAutoRefresh" href="output/Ext.Updater.html#stopAutoRefresh">stopAutoRefresh</a>. <div class="mdetail-params"> <strong>Parameters:</strong> <ul><li><code>interval</code> : Number<div class="sub-desc">How often to update (in seconds).</div></li><li><code>url</code> : String/Object/Function<div class="sub-desc">(optional) The url for this request, a config object in the same formatsupported by <a ext:cls="Ext.Updater" ext:member="load" href="output/Ext.Updater.html#load">load</a>, or a function to call to get the url (defaults to the last used url). Note that whilethe url used in a load call can be reused by this method, other load config options will not be reused and must besepcified as part of a config object passed as this paramter if needed.</div></li><li><code>params</code> : String/Object<div class="sub-desc">(optional) The parameters to pass as either a url encoded string"¶m1=1¶m2=2" or as an object {param1: 1, param2: 2}</div></li><li><code>callback</code> : Function<div class="sub-desc">(optional) Callback when transaction is complete - called with signature (oElement, bSuccess)</div></li><li><code>refreshNow</code> : Boolean<div class="sub-desc">(optional) Whether to execute the refresh now, or wait the interval</div></li> </ul> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> <tr class="method-row alt expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-stopAutoRefresh"></a> <b>stopAutoRefresh</b>() : void <div class="mdesc"> <div class="short">Stop auto refresh on this element.</div> <div class="long"> Stop auto refresh on this element. <div class="mdetail-params"> <strong>Parameters:</strong> <ul><li>None.</li> </ul> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> <tr class="method-row inherited expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-suspendEvents"></a> <b>suspendEvents</b>() : void <div class="mdesc"> <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> <div class="long"> 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"> <strong>Parameters:</strong> <ul><li>None.</li> </ul> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">Observable</a></td> </tr> <tr class="method-row inherited alt expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-un"></a> <b>un</b>( <code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span> ) : void <div class="mdesc"> <div class="short">Removes a listener (shorthand for removeListener)</div> <div class="long"> Removes a listener (shorthand for removeListener) <div class="mdetail-params"> <strong>Parameters:</strong> <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> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#un" href="output/Ext.util.Observable.html#un">Observable</a></td> </tr> <tr class="method-row expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-update"></a> <b>update</b>( <code>Object options</code> ) : void <div class="mdesc"> <div class="short">Performs an asynchronous request, updating this element with the response.If params are specified it uses POST, othe...</div> <div class="long"> Performs an <b>asynchronous</b> request, updating this element with the response.If params are specified it uses POST, otherwise it uses GET.<br><br><b>Note:</b> Due to the asynchronous nature of remote server requests, the Elementwill not have been fully updated when the function returns. To post-process the returneddata, use the callback option, or an <b><tt>update</tt></b> event handler. <div class="mdetail-params"> <strong>Parameters:</strong> <ul><li><code>options</code> : Object<div class="sub-desc">A config object containing any of the following options:<ul><li>url : <b>String/Function</b><p class="sub-desc">The URL to request or a function which<i>returns</i> the URL (defaults to the value of <a ext:cls="Ext.Ajax" ext:member="url" href="output/Ext.Ajax.html#url">Ext.Ajax.url</a> if not specified).</p></li><li>method : <b>String</b><p class="sub-desc">The HTTP method touse. Defaults to POST if the <tt>params</tt> argument is present, otherwise GET.</p></li><li>params : <b>String/Object/Function</b><p class="sub-desc">Theparameters to pass to the server (defaults to none). These may be specified as a url-encodedstring, or as an object containing properties which represent parameters,or as a function, which returns such an object.</p></li><li>scripts : <b>Boolean</b><p class="sub-desc">If <tt>true</tt>any <script> tags embedded in the response text will be extractedand executed (defaults to <a ext:cls="Ext.Updater.defaults" ext:member="loadScripts" href="output/Ext.Updater.defaults.html#loadScripts">Ext.Updater.defaults.loadScripts</a>). If this option is specified,the callback will be called <i>after</i> the execution of the scripts.</p></li><li>callback : <b>Function</b><p class="sub-desc">A function tobe called when the response from the server arrives. The followingparameters are passed:<ul><li><b>el</b> : Ext.Element<p class="sub-desc">The Element being updated.</p></li><li><b>success</b> : Boolean<p class="sub-desc">True for success, false for failure.</p></li><li><b>response</b> : XMLHttpRequest<p class="sub-desc">The XMLHttpRequest which processed the update.</p></li><li><b>options</b> : Object<p class="sub-desc">The config object passed to the update call.</p></li></ul></p></li><li>scope : <b>Object</b><p class="sub-desc">The scope in whichto execute the callback (The callback's <tt>this</tt> reference.) If the<tt>params</tt> argument is a function, this scope is used for that function also.</p></li><li>discardUrl : <b>Boolean</b><p class="sub-desc">By default, the URL of this request becomesthe default URL for this Updater object, and will be subsequently used in <a ext:cls="Ext.Updater" ext:member="refresh" href="output/Ext.Updater.html#refresh">refresh</a>calls. To bypass this behavior, pass <tt>discardUrl:true</tt> (defaults to false).</p></li><li>timeout : <b>Number</b><p class="sub-desc">The number of seconds to wait for a response beforetiming out (defaults to <a ext:cls="Ext.Updater.defaults" ext:member="timeout" href="output/Ext.Updater.defaults.html#timeout">Ext.Updater.defaults.timeout</a>).</p></li><li>text : <b>String</b><p class="sub-desc">The text to use as the innerHTML of the<a ext:cls="Ext.Updater.defaults" ext:member="indicatorText" href="output/Ext.Updater.defaults.html#indicatorText">Ext.Updater.defaults.indicatorText</a> div (defaults to 'Loading...'). To replace the entire div, notjust the text, override <a ext:cls="Ext.Updater.defaults" ext:member="indicatorText" href="output/Ext.Updater.defaults.html#indicatorText">Ext.Updater.defaults.indicatorText</a> directly.</p></li><li>nocache : <b>Boolean</b><p class="sub-desc">Only needed for GETrequests, this option causes an extra, auto-generated parameter to be appended to the requestto defeat caching (defaults to <a ext:cls="Ext.Updater.defaults" ext:member="disableCaching" href="output/Ext.Updater.defaults.html#disableCaching">Ext.Updater.defaults.disableCaching</a>).</p></li></ul><p>For example:<pre><code>um.update({ url: <em>"your-url.php"</em>, params: {param1: <em>"foo"</em>, param2: <em>"bar"</em>}, <i>// or a URL encoded string</i> callback: yourFunction, scope: yourObject, <i>//(optional scope)</i> discardUrl: true, nocache: true, text: <em>"Loading..."</em>, timeout: 60, scripts: false <i>// Save time by avoiding RegExp execution.</i>});</code></pre></div></li> </ul> <strong>Returns:</strong> <ul> <li><code>void</code></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> </table> <a id="Ext.Updater-events"></a> <h2>Public Events</h2> <table cellspacing="0" class="member-table"> <tr> <th class="sig-header" colspan="2">Event</th> <th class="msource-header">Defined By</th> </tr> <tr class="event-row expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-beforeupdate"></a> <b>beforeupdate</b> : ( <code>Ext.Element el</code>, <code>String/Object/Function url</code>, <code>String/Object params</code> ) <div class="mdesc"> <div class="short">Fired before an update is made, return false from your handler and the update is cancelled.</div> <div class="long"> Fired before an update is made, return false from your handler and the update is cancelled. <div class="mdetail-params"> <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong> <ul><li><code>el</code> : Ext.Element<div class="sub-desc"></div></li><li><code>url</code> : String/Object/Function<div class="sub-desc"></div></li><li><code>params</code> : String/Object<div class="sub-desc"></div></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> <tr class="event-row alt expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-failure"></a> <b>failure</b> : ( <code>Ext.Element el</code>, <code>Object oResponseObject</code> ) <div class="mdesc"> <div class="short">Fired on update failure.</div> <div class="long"> Fired on update failure. <div class="mdetail-params"> <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong> <ul><li><code>el</code> : Ext.Element<div class="sub-desc"></div></li><li><code>oResponseObject</code> : Object<div class="sub-desc">The response Object</div></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> <tr class="event-row expandable"> <td class="micon"><a class="exi" href="#expand"> </a></td> <td class="sig"> <a id="Ext.Updater-update"></a> <b>update</b> : ( <code>Ext.Element el</code>, <code>Object oResponseObject</code> ) <div class="mdesc"> <div class="short">Fired after successful update is made.</div> <div class="long"> Fired after successful update is made. <div class="mdetail-params"> <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong> <ul><li><code>el</code> : Ext.Element<div class="sub-desc"></div></li><li><code>oResponseObject</code> : Object<div class="sub-desc">The response Object</div></li> </ul> </div> </div> </div> </td> <td class="msource">Updater</td> </tr> </table> </div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -