Class Index | File Index

Classes


Namespace jsf.ajax

The namespace for Ajax functionality.
Defined in: jsf.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The namespace for Ajax functionality.
Method Summary
Method Attributes Method Name and Description
<static>  
jsf.ajax.addOnError(callback)
Register a callback for error handling.
<static>  
jsf.ajax.addOnEvent(callback)
Register a callback for event handling.
<static>  
jsf.ajax.request(source, event, options)

Send an asynchronous Ajax req uest to the server.

<static>  
jsf.ajax.response(request, context)

Receive an Ajax response from the server.

Namespace Detail
jsf.ajax
The namespace for Ajax functionality.
Method Detail
<static> jsf.ajax.addOnError(callback)
Register a callback for error handling.

Usage:


jsf.ajax.addOnError(handleError);
...
var handleError = function handleError(data) {
...
}

Implementation Requirements:

This function must accept a reference to an existing JavaScript function. The JavaScript function reference must be added to a list of callbacks, making it possible to register more than one callback by invoking jsf.ajax.addOnError more than once. This function must throw an error if the callback argument is not a function.
Parameters:
callback
a reference to a function to call on an error

<static> jsf.ajax.addOnEvent(callback)
Register a callback for event handling.

Usage:


jsf.ajax.addOnEvent(statusUpdate);
...
var statusUpdate = function statusUpdate(data) {
...
}

Implementation Requirements:

This function must accept a reference to an existing JavaScript function. The JavaScript function reference must be added to a list of callbacks, making it possible to register more than one callback by invoking jsf.ajax.addOnEvent more than once. This function must throw an error if the callback argument is not a function.
Parameters:
callback
a reference to a function to call on an event

<static> jsf.ajax.request(source, event, options)

Send an asynchronous Ajax req uest to the server.

Usage:


Example showing all optional arguments:

<commandButton id="button1" value="submit"
    onclick="jsf.ajax.request(this,event,
      {execute:'button1',render:'status',onevent: handleEvent,onerror: handleError});return false;"/>
</commandButton/>

Implementation Requirements:

This function must: Form serialization should occur just before the request is sent to minimize the amount of time between the creation of the serialized form data and the sending of the serialized form data (in the case of long requests in the queue). Before the request is sent it must be put into a queue to ensure requests are sent in the same order as when they were initiated. The request callback function must examine the queue and determine the next request to be sent. The behavior of the request callback function must be as follows:

Parameters:
source
The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element.
event
The DOM event that triggered this Ajax request. The event argument is optional.
options
The set of available options that can be sent as request parameters to control client and/or server side request processing. Acceptable name/value pair options are:
name value
execute space seperated list of client identifiers
render space seperated list of client identifiers
onevent function to callback for event
onerror function to callback for error
params object containing parameters to include in the request
delay If less than delay milliseconds elapses between calls to request() only the most recent one is sent and all other requests are discarded. If the value of delay is the literal string 'none' without the quotes, or no delay is specified, no delay is used.
resetValues If true, ensure a post data argument with the name javax.faces.partial.resetValues and the value true is sent in addition to the other post data arguments. This will cause UIViewRoot.resetValues() to be called, passing the value of the "render" attribute. Note: do not use any of the @ keywords such as @form or @this with this option because UIViewRoot.resetValues() does not descend into the children of the listed components.
The options argument is optional.
Throws:
Error if first required argument element is not specified, or if one or more of the components in the options.execute list is a file upload component, but the form's enctype is not set to multipart/form-data

<static> jsf.ajax.response(request, context)

Receive an Ajax response from the server.

Usage:


jsf.ajax.response(request, context);

Implementation Requirements:

This function must evaluate the markup returned in the request.responseXML object and perform the following action:

Parameters:
request
The XMLHttpRequest instance that contains the status code and response message from the server.
context
An object containing the request context, including the following properties: the source element, per call onerror callback function, and per call onevent callback function.
Throws:
Error if request contains no data

Documentation generated by JsDoc Toolkit 2.0.2 on Tue Sep 05 2017 18:26:11 GMT-0400 (EDT)