Callback for an AJAX request that is called in case any error occurred during the request, such as a a network error. Note that this is not called for errors in the application logic, such as when bean validation fails.
This is the type of function that you can set as a client side callback for the onerror
attribute of a
component or an AJX behavior.
Callback for an AJAX request that is called before the request is sent. Return false
to cancel the request.
This is the type of function that you can set as a client side callback for the onstart
attribute of a
component or an AJX behavior.
Callback for an AJAX request that is called when the request succeeds.
This is the type of function that you can set as a client side callback for the onsuccess
attribute of a
component or an AJX behavior.
Additional options that can be passed when sending an AJAX request to override the current options.
An entry on the JQuery.jqXHR request object with additional values added by PrimeFaces. For example, when
you call PrimeFaces.current().ajax().addCallbackParam(...)
on the server in a bean method, the added parameters
are available in this object. This is also how you can access pass values from the server to the client after
calling a remote command. See PrimeFaces.ajax.pfXHR and PrimeFaces.ab.
Additional settings on a JQuery.jqXHR request, such as portlet forms and nonces.
Object type with the param names and the corresponding param values.
Object type of the data returned by the remote command.
Type for the JavaScript remote command function that is created via
<p:remoteCommand name="myCommand" listener="#{myBean.action}" />
This creates a variable window.myCommand
that is of this type. On the client-side, you can pass parameters to
the remote command via
window.myCommand([ { name: "myParamName", value: 9 } ]);
On the server-side, you can access them as follows:
String myParamValue = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParamName")
To send data back to the client, use
PrimeFaces.current().ajax().addCallbackParam("returnParamName", true);
Finally, to access the returned value on the client, do
try {
const response = await window.myCommand([ { name: "myParamName", value: 9 } ]);
// Success, do something with the data
const value = response.jqXHR.pfArgs.returnParamName;
}
catch (e) {
// Handle error
console.error("Could not invoke remote command", e);
}
Please note that you should not use async-await if you need to target old browsers, use then
/catch
on the
returned promise instead. See RemoteCommandParams for more details on how to use this TypeScript type.
Helper type for the parameters of the remote command. You can specify an object type with the allowed parameter names and their expected value types. This helps to increase type safety for remote commands. For example, when this remote command with an appropriate bean implementation is defined:
<p:remoteCommand name="RemoteCommands.checkMaturity" ... />
Then you can declare (or generate automatically from the bean method!) this remote command in TypeScript like this:
declare const RemoteCommands {
const checkMaturity: RemoteCommand<
{name: string, age: number},
{success: boolean, message: string}
>;
}
RemoteCommand.checkMaturity( [ { name: "name", value: "John Doe" } ] ) // works
RemoteCommand.checkMaturity( [ { name: "age", value: 12 } ] ) // works
RemoteCommand.checkMaturity( [ { name: "username", value: "John Doe" } ] ) // error
RemoteCommand.checkMaturity( [ { name: "age", value: "12" } ] ) // error
const response = await RemoteCommand.checkMaturity( [ { name: "name", value: "John Doe" } ];
const success: boolean = response.jqXHR.pfArgs.success; // works
const message: string = response.jqXHR.pfArgs.message; // works
const message: string = response.jqXHR.pfArgs.errormessage; // error
Record type with the param names and the corresponding param values.
Options passed to AJAX calls made by PrimeFaces. This is the same as Configuration
, but with shorter
option names and is used mainly by the method PrimeFaces.ab
. See Configuration
for a detailed description
of these options.
Parameter shortcut mapping for the method PrimeFaces.ab
.
This object contains functionality related to queuing AJAX requests to ensure that they are (a) sent in the proper order and (b) that each response is processed in the same order as the requests were sent.
Name for the ID of a resource entry, used in AJAX requests.
The interface for the object containing low-level functionality related to sending AJAX requests.
The interface for the object containing low-level functionality related to handling AJAX responses. Note that
the different types of AJAX actions are handles by the PrimeFaces.ResponseProcessor
.
The interface for the object containing low-level functionality related to processing the different types of actions from AJAX responses.
This object contains utility methods for AJAX requests, primarily used internally.
Name for the ID of the BODY element, used in AJAX requests.
Name for the ID of the HEAD element, used in AJAX requests.
Minimum number of milliseconds to show inline Ajax load animations.
Only available for backward compatibility, do not use in new code.
Configuration for the AJAX request to send, such as the HTTP method, the URL, and the content of the request.
Optional extender with additional options
that overwrite the options given in cfg
.
Always returns undefined
.
Generated using TypeDoc
Callback for an AJAX request that is always called after the request completes, irrespective of whether it succeeded or failed.
This is the type of function that you can set as a client side callback for the
oncomplete
attribute of a component or an AJX behavior.