Package: | Ext |
Class: | Ajax |
Extends: | Connection |
Defined In: | Connection.js |
Property | Defined By | |
---|---|---|
autoAbort : Boolean | Ajax | |
Whether a new request should abort any pending requests. (defaults to false) | ||
defaultHeaders : Object | Ajax | |
An object containing request headers which are added to each request made by this object. (defaults to undefined) | ||
disableCaching : Boolean | Ajax | |
True to add a unique cache-buster param to GET requests. (defaults to true) | ||
extraParams : Object | Ajax | |
An object containing properties which are used as extra parameters to each request made by this object. (defaults to... | ||
method : String | Ajax | |
The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use P... | ||
timeout : Number | Ajax | |
The timeout in milliseconds to be used for requests. (defaults to 30000) | ||
url : String | Ajax | |
The default URL to be used for requests to the server. (defaults to undefined) |
Method | Defined By | |
---|---|---|
abort( [Number transactionId ] ) : void |
Connection | |
Aborts any outstanding request. | ||
addEvents( Object object ) : void |
Observable | |
Used to define events on this Observable | ||
addListener( String eventName , Function handler , [Object scope ], [Object options ] ) : void |
Observable | |
Appends an event handler to this component | ||
fireEvent( String eventName , Object... args ) : Boolean |
Observable | |
Fires the specified event with the passed parameters (minus the event name). | ||
hasListener( String eventName ) : Boolean |
Observable | |
Checks to see if this object has any listeners for a specified event | ||
isLoading( [Number transactionId ] ) : Boolean |
Connection | |
Determine whether this object has a request outstanding. | ||
on( String eventName , Function handler , [Object scope ], [Object options ] ) : void |
Observable | |
Appends an event handler to this element (shorthand for addListener) | ||
purgeListeners() : void | Observable | |
Removes all listeners for this object | ||
removeListener( String eventName , Function handler , [Object scope ] ) : void |
Observable | |
Removes a listener | ||
request( [Object options ] ) : Number |
Connection | |
Sends an HTTP request to a remote server. | ||
serializeForm( String/HTMLElement form ) : String |
Ajax | |
Serialize the passed form into a url encoded string | ||
un( String eventName , Function handler , [Object scope ] ) : void |
Observable | |
Removes a listener (shorthand for removeListener) |
Event | Defined By | |
---|---|---|
beforerequest : ( Connection conn , Object options ) |
Connection | |
Fires before a network request is made to retrieve a data object. | ||
requestcomplete : ( Connection conn , Object response , Object options ) |
Connection | |
Fires if the request was successfully completed. | ||
requestexception : ( Connection conn , Object response , Object options ) |
Connection | |
Fires if an error HTTP status was returned from the server. See {@link http://www.w3.org/Protocols/rfc2616/rfc2616-se... |
public Boolean autoAbort
public Object defaultHeaders
public Boolean disableCaching
public Object extraParams
public String method
public Number timeout
public String url
public function abort( [Number transactionId
] )
transactionId
: Numbervoid
public function addEvents( Object object
)
object
: Objectvoid
public function addListener( String eventName
, Function handler
, [Object scope
], [Object options
] )
eventName
: Stringhandler
: Functionscope
: Objectoptions
: Object
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
el.on('click', this.onClick, this, {
single: true,
delay: 100,
forumId: 4
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.
el.on({
'click': {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover': {
fn: this.onMouseOver,
scope: this
},
'mouseout': {
fn: this.onMouseOut,
scope: this
}
});
Or a shorthand syntax which passes the same scope object to all handlers:
el.on({
'click': this.onClick,
'mouseover': this.onMouseOver,
'mouseout': this.onMouseOut,
scope: this
});
void
public function fireEvent( String eventName
, Object... args
)
eventName
: Stringargs
: Object...Boolean
public function hasListener( String eventName
)
eventName
: StringBoolean
public function isLoading( [Number transactionId
] )
transactionId
: NumberBoolean
public function on( String eventName
, Function handler
, [Object scope
], [Object options
] )
eventName
: Stringhandler
: Functionscope
: Objectoptions
: Objectvoid
public function purgeListeners()
void
public function removeListener( String eventName
, Function handler
, [Object scope
] )
eventName
: Stringhandler
: Functionscope
: Objectvoid
public function request( [Object options
] )
options
: ObjectNumber
public function serializeForm( String/HTMLElement form
)
form
: String/HTMLElementString
public function un( String eventName
, Function handler
, [Object scope
] )
eventName
: Stringhandler
: Functionscope
: Objectvoid
public event beforerequest
conn
: Connectionoptions
: Objectpublic event requestcomplete
conn
: Connectionresponse
: Objectoptions
: Objectpublic event requestexception
conn
: Connectionresponse
: Objectoptions
: Object