Constructs a new type by binding the this context of Base
to another type ThisContext
.
type X = (this: string, x: string) => boolean;
type Y = BindThis<X, number>;
// type Y = (this: number, x: string) => boolean
Type to rebind.
New this context for Base
.
Constructs a new type by binding the this context of Base
to the ThisContext
. Additionally, also adds a new
property _super
to the this context of Base
that is also of type Base
.
type X = {foo: string, bar: number};
type Y = (this: string, k: string) => boolean;
type Z = BindThis<Y, X>;
// type Z = (this: {foo: string, bar: number, _super: Y}, k: string) => boolean
Type to rebind.
New this context for Base
.
Given the type of the base class and the sub class, constructs a new type for the argument of Class.extend(...)
,
except that all properties are required.
Type of the base class.
Type of the subclass.
Defines the possible severity levels of a faces message (a message shown to the user).
Constructs an object type out of a union of two-tuples. The first item in the pair is used as the key, the second item as the type of the property's value.
type Y = ["bar", RegExp] | ["foo", number];
type Z = KeyValueTupleToObject<Y>;
// type Z = { bar: RegExp; foo: number; }
A union of pairs with the key and value for the object's properties.
Constructs a new type that is the intersection of all property names in Base
whose type is assignable to
Condition
:
```typescript interface User { name: string; mail: string; active: boolean; }
type UserStringKeys = MatchingKeys<User, string>; // type UserStringKeys = "name" | "mail"; ```
Type from which to pick some properties.
Type which the properties in the base type have to match.
Constructs a new type by making all properties Key
in Base
optional.
type X = {foo: string, bar: string, baz: string};
type Y = PartialBy<X, "foo" | "baz">;
// type Y = {foo?: string, bar: string, baz?: string};
Type for which some properties are made optional.
Type of the keys that are made optional.
Similar to Partial<Base>
, but in addition to making the properties optional, also makes the properties
nullable.
Type of an object with properties to make partial.
The widget configuration of each widget may contain only some of the declared properties. For example, when the
value of a property is equal to the default value, it is not transmitted from the server to the client. Only the
two properties id
and widgetVar
are guaranteed to be always available.
Type of a widget configuration. It must have at least the two properties id
and widgetVar
.
Constructs a new type by picking from Base
all properties that are assignable to Condition
.
```typescript interface User { name: string; mail: string; active: boolean; }
type UserStringProperties = PickMatching<User, string>; // type UserStringProperties = {name: string, mail: string}; ```
Type from which to pick some properties.
Type which the properties in the base type have to match.
Constructs a new type by renaming the properties in Base
according to the RenameMap
.
type Z = { bar: RegExp; foo: number; };
type S = RenameKeys<Z, {bar: "b", foo: "f"}>;
// type S = { b: RegExp; f: number; }
Type with properties to rename
Type with string properties that indicate how to rename the keys of Base
.
Constructs a new type by intersecting the given Base
with void
. This is a hack, required because some methods
of a parent class explicitly return a value, but some derived classes do not.
Base type to intersect
Maps the return type of a method of an instance method of a JQueryUI widget instance to the return type of the JQueryUI wrapper:
undefined
or the instance itself, the JQuery instance is returned.Type of the widget instance.
Type of a value returned by a widget instance method.
Type of the JQuery instance.
Constructs a new type that is the union of all types of each property in T.
type X = {a: ["bar", RegExp], b: ["foo", number]};
type Y = ValueOf<X>;
// type Y = ["bar", RegExp] | ["foo", number]
A type with keys.template
Name of the POST parameter that contains the name of the current behavior event.
Name of the POST parameter with the current client ID
Name of the POST parameter with the current client window.
Name of the POST parameter that indicates whether <p:autoUpdate>
tags should be ignored.
Name of the POST parameter that contains the name of the current partial behavior event.
Name of the POST parameter that contains the list of components to process.
Name of the POST parameter that indicates whether the request is an AJAX request.
Name of the POST parameter that indicates which element or component triggered the AJAX request.
Name of the POST parameter that contains the list of components to be updated.
Name of the POST parameter that indicates whether forms should have their values reset.
Name of the faces resource servlet, eg. javax.faces.resource
.
Name of the POST parameter that indicates whether children should be skipped.
The current version of PrimeFaces.
Name of the POST parameter that contains the view root.
Name of the POST parameter that contains the current view state.
Flag for detecting whether animation is currently running. Similar to jQuery.active flag and is useful for scripts or automation tests to determine if the animation is currently running.
Global flag for enabling or disabling both jQuery and CSS animations.
The most recent instance of a PrimeFaces.widget.ConfirmDialog instance that was opened in response to a global confirmation request.
The main container element of the source component that issued the popup confirmation request, used e.g. by the
ConfirmPopup
widget.
The main container element of the source component that issued the confirmation request, used e.g. by the
ConfirmDialog
widget.
An object with the client-side implementation of some faces converters.
Used to store whether a custom focus has been rendered. This avoids having to retain the last focused element after AJAX update.
Some widgets need to compute their dimensions based on their parent element(s). This requires that such
widgets are not rendered until they have become visible. A widget may not be visible, for example, when it
is inside a tab that is not shown when the page is rendered. PrimeFaces provides a global mechanism for
widgets to render once they are visible. This is done by keeping a list of widgets that need to be rendered,
and checking on every change (AJAX request, tab change etc.) whether any of those have become visible. A
widgets should extend PrimeFaces.widget.DeferredWidget
to make use of this functionality.
This is the list of renders for widgets that are currently waiting to become visible.
A list of widgets that were once instantiated, but are not removed from the DOM, such as due to the result of an AJAX update request.
A map between some HTML entities and their HTML-escaped equivalent.
PrimeFaces per defaults hides all overlays on scrolling/resizing to avoid positioning problems. This is really hard to overcome in selenium tests and we can disable this behavior with this setting.
A map with language specific translations. This is a map between the language keys and another map with the i18n keys mapped to the translation.
An object with the client-side implementation of some faces validators. Used for implementing client-side validation for quick feedback.
A registry of all instantiated widgets that are available on the current page.
A tracker for the current z-index, used for example when creating multiple modal dialogs.
A shortcut for PrimeFaces.ajax.Request.handle(cfg, ext)
, with shorter option names. Sends an AJAX request to
the server and processes the response. You can use this method if you need more fine-grained control over which
components you want to update or process, or if you need to change some other AJAX options.
Configuration for the AJAX request, with shorthand
options. The individual options are documented in PrimeFaces.ajax.Configuration
.
Optional extender with additional options that
overwrite the options given in cfg
.
A promise that resolves once the AJAX requests is done. Use this to run custom JavaScript logic. When the AJAX request succeeds, the promise is fulfilled. Otherwise, when the AJAX request fails, the promise is rejected. If the promise is rejected, the rejection handler receives an object of type PrimeFaces.ajax.FailedRequestData.
Aborts all pending AJAX requests. This includes both requests that were already sent but did not receive a response yet, as well as requests that are waiting in the queue and have not been sent yet.
Some widgets need to compute their dimensions based on their parent element(s). This requires that such
widgets are not rendered until they have become visible. A widget may not be visible, for example, when it
is inside a tab that is not shown when the page is rendered. PrimeFaces provides a global mechanism for
widgets to render once they are visible. This is done by keeping a list of widgets that need to be rendered,
and checking on every change (AJAX request, tab change etc.) whether any of those have become visible. A
widgets should extend PrimeFaces.widget.DeferredWidget
to make use of this functionality.
Adds a deferred render to the global list. If this widdget has already been added only the last instance will be added to the stack.
The ID of a deferred widget.
ID of the container that should be visible before the widget can be rendered.
Callback that is invoked when the widget may possibly have become visible. Should
return true
when the widget was rendered, or false
when the widget still needs to be rendered later.
Adds hidden input elements to the given form. For each key-value pair, a new hidden input element is created with the given value and the key used as the name.
The ID of a FORM element.
An object with key-value pairs.
This object for chaining.
Attaches the given behaviors to the element. For each behavior, an event listener is registered on the element. Then, when the event is triggered, the behavior callback is invoked.
The element for which to attach the behaviors.
An object with an event name as the key and event handlers for that event as the value. Each event handler is called with the given element as the this context and the event that occurred as the first argument.
A function that is used as the handler function for HTML event tags (onclick
, onkeyup
etc.). When a
component has got an onclick
etc attribute, the JavaScript for that attribute is called by this method.
Element on which the event occurred.
Event that occurred.
A list of callback
functions. If any returns false
, the default action of the event is prevented.
A function that is used as the handler function for AJAX behaviors. When a component has got an AJAX behavior, the JavaScript that implements behavior's client-side logic is called by this method.
Additional options to override the current options.
Event that occurred.
A list of callback functions. If any returns false
, the other callbacks are not invoked.
Applies the inline AJAX status (ui-state-loading) to the given widget / button.
the widget.
The button DOM element.
Callback that checks if the widget is the source of the current AJAX request.
Ends the AJAX disabled state.
the widget.
The button DOM element.
Finds the width of the scrollbar that is used by the current browser, as scrollbar widths are different for across different browsers.
The width of the scrollbars of the current browser.
Changes the current theme to the given theme (by exchanging CSS files). Requires that the theme was installed and is available.
The new theme, eg. luna-amber
, nova-dark
, or omega
.
Clears the text selected by the user on the current page.
Deprecated, use PrimeFaces.dialog.DialogHandler.closeDialog
instead.
Configuration of the dialog.
Displays dialog or popup according to the type of confirm component.
Message to show with the confirm dialog or popup.
Checks whether cookies are enabled in the current browser.
true
if cookies are enabled and can be used, false
otherwise.
Generates a unique key for using in HTML5 local storage by combining the context, view, id, and key.
ID of the component
a unique key name such as the component name
if global then do not include the view id
the generated key comprising of context + view + id + key
Creates a new widget of the given type and with the given configuration. Registers that widget in the widgets registry PrimeFaces.widgets. If this method is called in response to an AJAX request and the method exists already, it is refreshed.
Name of the widget class, as registered in PrimeFaces.widget
Widget variable of the widget
Configuration for the widget
A shortcut for createWidget.
Name of the widget class, as registered in PrimeFaces.widget.
Widget variable of the widget
Configuration for the widget
Logs the given message at the debug
level.
Message to log
Deletes the given cookie.
Name of the cookie to delete
The cookie configuration used to set the cookie.
Fetches the resource at the given URL and prompts the user to download that file, without leaving the current page. This function is usually called by server-side code to download a data URI or a data from a remote URL.
URL pointing to the resource to download.
The MIME content-type of the file to download. It helps the browser present friendlier information about the download to the user, encouraging them to accept the download.
The name of the file to be created. Note that older browsers (like FF3.5, Ch5) do not honor the file name you provide, instead they automatically name the downloaded file.
Name of the file download cookie (by default primefaces.download
). This function
makes sure the cookie is set properly when the download finishes.
Logs the given message at the error
level.
Message to log
Creates an ID to a CSS ID selector that matches elements with that ID. For example:
PrimeFaces.escapeClientId("form:input"); // => "#form\:input"
PrimeFaces.escapeClientId("form#input"); // => "#form#input"
Please note that this method does not escape all characters that need to be escaped and will not work with arbitrary IDs
ID to convert.
A CSS ID selector for the given ID.
Escapes the given value to be used as the content of an HTML element or attribute.
A string to be escaped
if true will not include ampersand to prevent double escaping
The given value, escaped to be used as a text-literal within an HTML document.
Creates a regexp that matches the given text literal, and HTML-escapes that result.
The literal text to escape.
A regexp that matches the given text, escaped to be used as a text-literal within an HTML document.
Attempts to put focus an element:
id
is given, puts focus on the element with that id
context
is given, puts focus on the first focusable element within that context
(container)ID of an element to focus.
The ID of a container with an element to focus
Puts focus on the given element.
Element to focus
Some ARIA attributes have a value that depends on the current locale. This returns the localized version for the given aria key.
An aria key
Optional default if key is not found
The translation for the given aria key
Gets the form by id or the closest form if the id is not a form itself. In AJAX we also have a fallback for the first form in DOM, this should not be used here.
ID of the component to get the closest form or if its a form itself
the form or NULL if no form found
Fetches the value of a cookie by its name
Name of a cookie
The value of the given cookie, or undefined
if no such cookie exists
Deprecated, use PrimeFaces.resources.getFacesResource instead.
Name of the resource
Library of the resource
Version of the resource
The URL for accessing the given resource.
Attempt to look up the locale key by current locale and fall back to US English if not found.
The locale key
The translation for the given key
Finds the current locale with the i18n keys and the associated translations. Uses the current language key
as specified by PrimeFaces.settings.locale
. When no locale was found for the given locale, falls back to
the default English locale.
optional configuration locale from the widget
The current locale with the key-value pairs.
Finds the text currently selected by the user on the current page.
The text currently selected by the user on the current page.
Gets the currently loaded PrimeFaces theme.
The current theme, such as omega
or luna-amber
. Empty string when no theme is loaded.
Gets the currently loaded PrimeFaces theme CSS link.
The full URL to the theme CSS
Finds a widget in the current page with the given ID.
ID of the widget to retrieve.
The widget with the given ID, of null
if no such widget was
found.
Finds all widgets in the current page that are of the given type.
Type of the widgets of interest, e.g.
PrimeFaces.widget.DataTable
.
The (proto)type of the widgets of interest, e.g., PrimeFaces.widget.DataTable
.
An array of widgets that are of the requested type. If no suitable widgets are found on the current page, an empty array will be returned.
Checks whether any text on the current page is selected by the user.
true
if text is selected, false
otherwise.
Checks whether an items is contained in the given array. The items is compared against the array entries
via the ===
operator.
Defaults to unknown
. Type of the array items
An array with items
An item to check
true
if the given item is in the given array, false
otherwise.
Logs the given message at the info
level.
Message to log
Some widgets need to compute their dimensions based on their parent element(s). This requires that such
widgets are not rendered until they have become visible. A widget may not be visible, for example, when it
is inside a tab that is not shown when the page is rendered. PrimeFaces provides a global mechanism for
widgets to render once they are visible. This is done by keeping a list of widgets that need to be rendered,
and checking on every change (AJAX request, tab change etc.) whether any of those have become visible. A
widgets should extend PrimeFaces.widget.DeferredWidget
to make use of this functionality.
Invokes all deferred renders. This is usually called when an action was performed that may have resulted in a container now being visible. This includes actions such as an AJAX request request was made or a tab change.
ID of the container that may have become visible.
Checks whether the current application is running in a development environment or a production environment.
true
if this is a development environment, false
otherwise.
Checks whether a value is of type number
and is neither Infinity
nor NaN
.
A value to check
true
if the given value is a finite number (neither NaN
nor +/- Infinity
),
false
otherwise.
Checks whether the current application is running in a production environment.
true
if this is a production environment, false
otherwise.
As a <p:fileDownload>
process is implemented as a norma, non-AJAX request, <p:ajaxStatus>
will not work.
Still, PrimeFaces provides a feature to monitor file downloads via this client-side function. This is done
by sending a cookie with the HTTP response of the file download request. On the client-side, polling is used
to check when the cookie is set.
The example below displays a modal dialog when a download begins and hides it when the download is complete:
Client-side callbacks:
function showStatus() {
PF('statusDialog').show();
}
function hideStatus() {
PF('statusDialog').hide();
}
Server-side XHTML view:
<p:commandButton value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)">
<p:fileDownload value="#{fileDownloadController.file}"/>
</p:commandButton>
Callback that is invoked when the download starts.
Callback that is invoked when the download ends.
Name of the cookie for monitoring the download. The cookie name defaults to
primefaces.download
+ the current viewId. When a monitor key is given, the name of the cookie will consist of a prefix and the
given monitor key.
Increment and return the next z-index
for CSS as a string.
Note that jQuery will no longer accept numeric values in $.fn.css as of version 4.0.
the next z-index
as a string.
Registeres a listener that will be called as soon as the given element was loaded completely. Please note the listener may be called synchronously (immediately) or asynchronously, depending on whether the element is already loaded.
Element to wait for
Listener to call once the element is loaded
Deprecated, use PrimeFaces.dialog.DialogHandler.openDialog
instead.
Configuration of the dialog.
Queue a microtask if delay is 0 or less and setTimeout if > 0.
the function to call after the delay
the optional delay in milliseconds
the id associated to the timeout or undefined if no timeout used
Some widgets need to compute their dimensions based on their parent element(s). This requires that such
widgets are not rendered until they have become visible. A widget may not be visible, for example, when it
is inside a tab that is not shown when the page is rendered. PrimeFaces provides a global mechanism for
widgets to render once they are visible. This is done by keeping a list of widgets that need to be rendered,
and checking on every change (AJAX request, tab change etc.) whether any of those have become visible. A
widgets should extend PrimeFaces.widget.DeferredWidget
to make use of this functionality.
Removes a deferred render from the global list.
The ID of a deferred widget.
Reset any state variables on update="@all".
Scrolls to a component with given client id
The ID of an element to scroll to.
string or number determining how long the animation will run. Default to 400
Takes an input or textarea element and sets the caret (text cursor) position to the end of the the text.
An input or textarea element.
Sets the value of a given cookie. It will set secure=true, if using HTTPS and session-config/cookie-config/secure is set to true in web.xml. It will set sameSite, if secure=true, with the value of the primefaces.COOKIES_SAME_SITE parameter.
Name of the cookie to set
Value to set
Configuration for this cookie: when it expires, its paths and domain and whether it is secure cookie.
Deprecated, use {@link PrimeFaces.dialog.DialogHandler.showMessageInDialog} instead.
Message to show in a dialog.
BUTTON elements may have different states, such as hovering
or focused
. For each state, there is a
corresponding style class that is added to the button when it is in that state, such as ui-state-hover
or
ui-state-focus
. These classes are used by CSS rules for styling. This method sets up a button element so
that the classes are added correctly (by adding event listeners).
BUTTON element to skin
this for chaining
INPUT elements may have different states, such as hovering
or focused
. For each state, there is a
corresponding style class that is added to the input when it is in that state, such as ui-state-hover
or
ui-state-focus
. These classes are used by CSS rules for styling. This method sets up an input element so
that the classes are added correctly (by adding event listeners).
INPUT element to skin
this for chaining
SELECT elements may have different states, such as hovering
or focused
. For each state, there is a
corresponding style class that is added to the select when it is in that state, such as ui-state-hover
or
ui-state-focus
. These classes are used by CSS rules for styling. This method sets up a select element so
that the classes are added correctly (by adding event listeners).
SELECT element to skin
this for chaining
Submits the given form, and clears all ui-submit-param
s after that to prevent dom caching issues.
If a target is given, it is set on the form temporarily before it is submitted. Afterwards, the original target attribute of the form is restored.
ID of the FORM element.
The target attribute to use on the form during the submit process.
Converts a date into an ISO-8601 date without using the browser timezone offset.
the date to convert
ISO-8601 version of the date
Converts the provided string to searchable form.
to normalize.
flag indicating whether the string should be lower cased.
flag indicating whether the string should be normalized (accents to be removed from characters).
searchable string.
For 4.0 jQuery deprecated $.trim in favor of PrimeFaces.trim however that does not handle NULL and jQuery did so this function allows a drop in replacement.
the String to trim
trimmed value or "" if it was NULL
Generate a RFC-4122 compliant UUID to be used as a unique identifier.
A random UUID.
A shortcut for PrimeFaces.validation.validate
used by server-side renderers.
If the ajax
attribute is set to true
(the default is false
), all inputs configured by the process
attribute are validated
and all messages for the inputs configured by the update
attribute are rendered.
Otherwise, if the ajax
attribute is set to the false
, all inputs of the parent form, of the source
attribute, are processed and updated.
An configuration.
true
if the request would not result in validation errors, or false
otherwise.
Logs the current PrimeFaces and jQuery version to console.
A shortcut for PrimeFaces.validation.validateInstant
. This is used by p:clientValidator
.
The ID of an element to validate, or the element itself.
If the invalid element should be highlighted.
If messages should be rendered.
true
if the element is valid, or false
otherwise.
Logs the given message at the warn
level.
Message to log
Handles the error case when a widget was requested that is not available. Currently just logs an error message.
Widget variables of a widget
Generated using TypeDoc
A callback function for a behavior of a widget. A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server and processes the response once it is received. This enables several features such as updating or replacing elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.