Object | +--YAHOO.ext.UpdateManager
Provides AJAX-style update for Element object using Yahoo
UI library YAHOO.util.Connect functionality.
Usage:
// Get it from a YAHOO.ext.Element object
var mgr = myElement.getUpdateManager();
mgr.update('http://myserver.com/index.php', 'param1=1¶m2=2');
...
mgr.formUpdate('myFormId', 'http://myserver.com/index.php');
// or directly (returns the same UpdateManager instance)
var mgr = new YAHOO.ext.UpdateManager('myElementId');
mgr.startAutoRefresh('http://myserver.com/index.php', 60);
mgr.onUpdate.subscribe(myFcnNeedsToKnow);
| Nested Class Summary | |
<static class> |
YAHOO.ext.UpdateManager.BasicRenderer |
| Field Summary | |
YAHOO.util.CustomEvent |
beforeUpdate
fired before update is made, return false from your handler and the update is cancelled. |
String |
defaultUrl
Cached url to use for refreshes. |
Boolean |
disableCaching
Whether to append unique parameter on get request to disable caching (Defaults to YAHOO.ext.UpdateManager.defaults.disableCaching or false). |
YAHOO.ext.Element |
el
The Element object |
Function |
formUpdateDelegate
Delegate for formUpdate() prebound to 'this', use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments |
String |
indicatorText
Text for loading indicator (Defaults to YAHOO.ext.UpdateManager.defaults.indicatorText or '<div class="loading-indicator">Loading...</div>'). |
Number |
loadScripts
True to process scripts in the output (Defaults to YAHOO.ext.UpdateManager.defaults.loadScripts (false)). |
YAHOO.util.CustomEvent |
onFailure
Fired on update failure. |
YAHOO.util.CustomEvent |
onUpdate
Fired after successful update is made. |
Function |
refreshDelegate
Delegate for refresh() prebound to 'this', use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments |
Object |
renderer
The renderer for this UpdateManager. |
String |
showLoadIndicator
Whether to show indicatorText when loading (Defaults to YAHOO.ext.UpdateManager.defaults.showLoadIndicator or true). |
String |
sslBlankUrl
Blank page URL to use with SSL file uploads (Defaults to YAHOO.ext.UpdateManager.defaults.sslBlankUrl or 'about:blank'). |
Number |
timeout
Timeout for requests or form posts in seconds (Defaults to YAHOO.ext.UpdateManager.defaults.timeout or 30 seconds). |
Object |
transaction
YAHOO.util.Connect transaction object of current executing transaction |
Function |
updateDelegate
Delegate for update() prebound to 'this', use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments |
<static> Object |
defaults
The defaults collection enables customizing the default behavior of UpdateManager |
| Constructor Summary | |
YAHOO.ext.UpdateManager
(<String/HTMLElement/YAHOO.ext.Element> el, <Boolean> forceNew)
|
|
| Method Summary * Parameter types in italic indicate optional parameters | |
void
|
abort()
Aborts the executing transaction |
void
|
formUpdate(<String/HTMLElement> form, <String> url, <Boolean> reset, <Function> callback)
Performs an async form post, updating this element with the response. |
YAHOO.ext.Element
|
getEl()
Get the Element this UpdateManager is bound to |
Object
|
getRenderer()
|
Object
|
isUpdating()
Returns true if an update is in progress |
void
|
refresh(<Function> callback)
Refresh the element with the last used url or defaultUrl. |
void
|
setDefaultUrl(<String/Function> defaultUrl)
Set the defaultUrl used for updates |
void
|
setRenderer(<Object> renderer)
Set the content renderer for this UpdateManager. |
void
|
showLoading()
Called to update the element to "Loading" state. |
void
|
startAutoRefresh(<Number> interval, <String/Function> url, <String/Object> params, <Function> callback, <Boolean> refreshNow)
Set this element to auto refresh. |
void
|
stopAutoRefresh()
Stop auto refresh on this element. |
void
|
update(<String/Function> url, <String/Object> params, <Function> callback, <Boolean> discardUrl)
Performs an async request, updating this element with the response. |
| Field Detail |
YAHOO.util.CustomEvent beforeUpdate
String defaultUrl
Boolean disableCaching
YAHOO.ext.Element el
Function formUpdateDelegate
String indicatorText
Number loadScripts
YAHOO.util.CustomEvent onFailure
YAHOO.util.CustomEvent onUpdate
Function refreshDelegate
Object renderer
String showLoadIndicator
String sslBlankUrl
Number timeout
Object transaction
Function updateDelegate
<static> Object defaults
| Constructor Detail |
YAHOO.ext.UpdateManager(<String/HTMLElement/YAHOO.ext.Element> el, <Boolean> forceNew)
el - The element to update
forceNew - (optional) By default the constructor checks to see if the passed element already has an UpdateManager and if it does it returns the same instance. This will skip that check (useful for extending this class).
| Method Detail |
void abort()
void formUpdate(<String/HTMLElement> form, <String> url, <Boolean> reset, <Function> callback)
form - The form Id or form element
url - (optional) The url to pass the form to. If omitted the action attribute on the form will be used.
reset - (optional) Whether to try to reset the form after the update
callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
YAHOO.ext.Element getEl()
Object getRenderer()
Object isUpdating()
void refresh(<Function> callback)
callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
void setDefaultUrl(<String/Function> defaultUrl)
defaultUrl - The url or a function to call to get the url
void setRenderer(<Object> renderer)
renderer - The object implementing the render() method
void showLoading()
void startAutoRefresh(<Number> interval, <String/Function> url, <String/Object> params, <Function> callback, <Boolean> refreshNow)
interval - How often to update (in seconds).
url - (optional) The url for this request or a function to call to get the url (Defaults to the last used url)
params - (optional) The parameters to pass as either a url encoded string "¶m1=1¶m2=2" or as an object {YAHOO.ext.UpdateManager.prototype.param1 = 1; YAHOO.ext.UpdateManager.prototype.param2 = 2;}
callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
refreshNow - (optional) Whether to execute the refresh now, or wait the interval
void stopAutoRefresh()
void update(<String/Function> url, <String/Object> params, <Function> callback, <Boolean> discardUrl)
url - The url for this request or a function to call to get the url
params - (optional) The parameters to pass as either a url encoded string "param1=1¶m2=2" or as an object {YAHOO.ext.UpdateManager.prototype.param1 = 1; YAHOO.ext.UpdateManager.prototype.param2 = 2;}
callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
discardUrl - (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.