Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Namespaces

Interfaces

Type Aliases

Variables

Functions

Type Aliases

Behavior: ((this: BaseWidget, ext?: Partial<ConfigurationExtender>) => void)

Type declaration

    • 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="..." />.

      Parameters

      Returns void

BindThis<Base, ThisContext>: Base extends ((...args: never[]) => unknown) ? ((this: ThisContext, ...args: Parameters<Base>) => ReturnType<Base>) : Base

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
returns

If Base is a function type, that type with the this context bound to ThisContext. Otherwise, returns just Base.

Type Parameters

  • Base

    Type to rebind.

  • ThisContext

    New this context for Base.

BindThisAndSuper<Base, ThisContext>: Base extends ((...args: never[]) => unknown) ? ((this: ThisContext & { _super: Base }, ...args: Parameters<Base>) => ReturnType<Base>) : 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
returns

If Base is a function type, that type with the this context bound to ThisContext and with an additional property _super of type Base added. Otherwise, returns just Base.

Type Parameters

  • Base

    Type to rebind.

  • ThisContext

    New this context for Base.

ClassExtendProps<TBase, TSub>: { [ P in keyof TSub]: P extends keyof TBase ? BindThisAndSuper<TBase[P], TSub> : BindThis<TSub[P], TSub> }

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.

returns

A mapped type with properties P. If the property P is function type F, then the this context is bound to TSub. Additionally, if P is a property only of TBase and not of TSub, a special property _super of type F is added to the this context.

Type Parameters

  • TBase

    Type of the base class.

  • TSub

    Type of the subclass.

FacesMessageSeverity: "fatal" | "error" | "warn" | "info"

Defines the possible severity levels of a faces message (a message shown to the user).

  • fatal: Indicates that the message reports a grave error that needs the immediate attention of the reader.
  • error: Indicates that the message reports an error that occurred, such as invalid user input or database connection failures etc.
  • warn: Indicates that the message reports a possible issue, but it does not prevent the normal operation of the system.
  • info: Indicates that the message provides additional information, if the reader is interested.
KeyValueTupleToObject<T>: { [ K in T[0]]: Extract<T, [K, unknown]>[1] }

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; }

Type Parameters

  • T extends [PropertyKey, unknown]

    A union of pairs with the key and value for the object's properties.

MatchingKeys<Base, Condition>: { [ Key in keyof Base]: Base[Key] extends Condition ? Key : never }[keyof Base]

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"; ```

returns

A string intersection type of property names from the base type that match the condition.

Type Parameters

  • Base

    Type from which to pick some properties.

  • Condition

    Type which the properties in the base type have to match.

PartialBy<Base, Key>: Omit<Base, Key> & Partial<Pick<Base, Key>>

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};
returns

A subtype of Base with the all properties Key made optional.

Type Parameters

  • Base

    Type for which some properties are made optional.

  • Key extends keyof Base

    Type of the keys that are made optional.

PartialOrNull<Base>: { [ P in keyof Base]?: Base[P] | null }

Similar to Partial<Base>, but in addition to making the properties optional, also makes the properties nullable.

returns

A new type with all properties of the given type Base made optional and nullable.

Type Parameters

  • Base

    Type of an object with properties to make partial.

PartialWidgetCfg<TCfg>: Partial<Omit<TCfg, "id" | "widgetVar">> & Pick<TCfg, "id" | "widgetVar">

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.

returns

A new type with all properties in the given type made optional, exception for id and widgetVar.

Type Parameters

  • TCfg extends { id: string | string[]; widgetVar: string }

    Type of a widget configuration. It must have at least the two properties id and widgetVar.

PickMatching<Base, Condition>: Pick<Base, MatchingKeys<Base, Condition>>

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}; ```

returns

A subtype of the base type with all properties excluded that do not match the condition.

Type Parameters

  • Base

    Type from which to pick some properties.

  • Condition

    Type which the properties in the base type have to match.

RenameKeys<Base, RenameMap>: KeyValueTupleToObject<ValueOf<{ [ Key in keyof Base]: [Key extends keyof RenameMap ? RenameMap[Key] : Key, Base[Key]] }>>

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 Parameters

  • Base

    Type with properties to rename

  • RenameMap extends Record<string, string>

    Type with string properties that indicate how to rename the keys of Base.

ReturnOrVoid<Base>: Base | void

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.

returns

A new type that is the intersection of the given Base with void.

Type Parameters

  • Base

    Base type to intersect

ToJQueryUIWidgetReturnType<W, R, JQ>: R extends W | undefined | void ? JQ : R extends undefined | void ? R | JQ : R

Maps the return type of a method of an instance method of a JQueryUI widget instance to the return type of the JQueryUI wrapper:

  • When an instance method returns undefined or the instance itself, the JQuery instance is returned.
  • Otherwise, the value of the instance method is returned.
returns

The type that is returned by the JQueryUI wrapper method.

Type Parameters

  • W

    Type of the widget instance.

  • R

    Type of a value returned by a widget instance method.

  • JQ

    Type of the JQuery instance.

ValueOf<T>: T[keyof T]

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]

Type Parameters

  • T

    A type with keys.template

Variables

BEHAVIOR_EVENT_PARAM: string

Name of the POST parameter that contains the name of the current behavior event.

CLIENT_ID_DATA: string

Name of the POST parameter with the current client ID

CLIENT_WINDOW: string

Name of the POST parameter with the current client window.

IGNORE_AUTO_UPDATE_PARAM: string

Name of the POST parameter that indicates whether <p:autoUpdate> tags should be ignored.

PARTIAL_EVENT_PARAM: string

Name of the POST parameter that contains the name of the current partial behavior event.

PARTIAL_PROCESS_PARAM: string

Name of the POST parameter that contains the list of components to process.

PARTIAL_REQUEST_PARAM: string

Name of the POST parameter that indicates whether the request is an AJAX request.

PARTIAL_SOURCE_PARAM: string

Name of the POST parameter that indicates which element or component triggered the AJAX request.

PARTIAL_UPDATE_PARAM: string

Name of the POST parameter that contains the list of components to be updated.

RESET_VALUES_PARAM: string

Name of the POST parameter that indicates whether forms should have their values reset.

RESOURCE_IDENTIFIER: string

Name of the faces resource servlet, eg. javax.faces.resource.

SKIP_CHILDREN_PARAM: string

Name of the POST parameter that indicates whether children should be skipped.

VERSION: string

The current version of PrimeFaces.

VIEW_ROOT: string

Name of the POST parameter that contains the view root.

VIEW_STATE: string

Name of the POST parameter that contains the current view state.

animationActive: boolean

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.

animationEnabled: boolean

Global flag for enabling or disabling both jQuery and CSS animations.

confirmDialog: ConfirmDialog | undefined

The most recent instance of a PrimeFaces.widget.ConfirmDialog instance that was opened in response to a global confirmation request.

confirmPopupSource: JQuery | undefined | null

The main container element of the source component that issued the popup confirmation request, used e.g. by the ConfirmPopup widget.

confirmSource: JQuery | undefined | null

The main container element of the source component that issued the confirmation request, used e.g. by the ConfirmDialog widget.

converter: Record<string, PrimeFaces.Converter>

An object with the client-side implementation of some faces converters.

customFocus: boolean

Used to store whether a custom focus has been rendered. This avoids having to retain the last focused element after AJAX update.

deferredRenders: DeferredRender[]

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.

detachedWidgets: BaseWidget[]

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.

entityMap: Record<string, string>

A map between some HTML entities and their HTML-escaped equivalent.

hideOverlaysOnViewportChange: boolean

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.

locales: Record<string, PrimeFaces.Locale>

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.

validator: Record<string, PrimeFaces.Validator>

An object with the client-side implementation of some faces validators. Used for implementing client-side validation for quick feedback.

widgets: Record<string, BaseWidget>

A registry of all instantiated widgets that are available on the current page.

zindex: number

A tracker for the current z-index, used for example when creating multiple modal dialogs.

Functions

  • 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.

    Parameters

    • cfg: Partial<PrimeFaces.ajax.ShorthandConfiguration>

      Configuration for the AJAX request, with shorthand options. The individual options are documented in PrimeFaces.ajax.Configuration.

    • Optional ext: Partial<ConfigurationExtender>

      Optional extender with additional options that overwrite the options given in cfg.

    Returns Promise<ResponseData>

    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.

  • abortXHRs(): void
  • 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.

    Returns void

  • addDeferredRender(widgetId: string, containerId: string, fn: (() => boolean)): void
  • 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.

    Parameters

    • widgetId: string

      The ID of a deferred widget.

    • containerId: string

      ID of the container that should be visible before the widget can be rendered.

    • fn: (() => boolean)

      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.

        • (): boolean
        • Returns boolean

    Returns void

  • addSubmitParam(parent: string, params: Record<string, string>): typeof PrimeFaces
  • 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.

    Parameters

    • parent: string

      The ID of a FORM element.

    • params: Record<string, string>

      An object with key-value pairs.

    Returns typeof PrimeFaces

    This object for chaining.

  • attachBehaviors(element: JQuery<HTMLElement>, behaviors: Record<string, ((this: JQuery<HTMLElement>, event: TriggeredEvent<any, any, any, any>) => void)>): void
  • 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.

    Parameters

    • element: JQuery<HTMLElement>

      The element for which to attach the behaviors.

    • behaviors: Record<string, ((this: JQuery<HTMLElement>, event: TriggeredEvent<any, any, any, any>) => void)>

      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.

    Returns void

  • bcn(element: HTMLElement, event: Event, functions: ((this: HTMLElement, event: Event) => undefined | boolean)[]): void
  • 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.

    Parameters

    • element: HTMLElement

      Element on which the event occurred.

    • event: Event

      Event that occurred.

    • functions: ((this: HTMLElement, event: Event) => undefined | boolean)[]

      A list of callback functions. If any returns false, the default action of the event is prevented.

    Returns void

  • 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.

    Parameters

    • ext: Partial<ConfigurationExtender>

      Additional options to override the current options.

    • event: Event

      Event that occurred.

    • fns: ((this: typeof PrimeFaces, ext: Partial<ConfigurationExtender>, event: Event) => undefined | boolean)[]

      A list of callback functions. If any returns false, the other callbacks are not invoked.

    Returns void

  • Ends the AJAX disabled state.

    Parameters

    Returns void

  • calculateScrollbarWidth(): number
  • Finds the width of the scrollbar that is used by the current browser, as scrollbar widths are different for across different browsers.

    Returns number

    The width of the scrollbars of the current browser.

  • changeTheme(newTheme: string): void
  • Changes the current theme to the given theme (by exchanging CSS files). Requires that the theme was installed and is available.

    Parameters

    • newTheme: string

      The new theme, eg. luna-amber, nova-dark, or omega.

    Returns void

  • clearSelection(): void
  • Clears the text selected by the user on the current page.

    Returns void

  • Deprecated, use PrimeFaces.dialog.DialogHandler.closeDialog instead.

    deprecated

    Parameters

    Returns void

  • Displays dialog or popup according to the type of confirm component.

    deprecated

    Deprecated, use {@link PrimeFaces.dialog.DialogHandler.confirm} instead.

    Parameters

    Returns void

  • cookiesEnabled(): boolean
  • Checks whether cookies are enabled in the current browser.

    Returns boolean

    true if cookies are enabled and can be used, false otherwise.

  • createStorageKey(id: string, key: string, global: boolean): string
  • Generates a unique key for using in HTML5 local storage by combining the context, view, id, and key.

    Parameters

    • id: string

      ID of the component

    • key: string

      a unique key name such as the component name

    • global: boolean

      if global then do not include the view id

    Returns string

    the generated key comprising of context + view + id + key

  • createWidget(widgetName: string, widgetVar: string, cfg: BaseWidgetCfg): void
  • 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.

    Parameters

    • widgetName: string

      Name of the widget class, as registered in PrimeFaces.widget

    • widgetVar: string

      Widget variable of the widget

    • cfg: BaseWidgetCfg

      Configuration for the widget

    Returns void

  • cw(widgetName: string, widgetVar: string, cfg: BaseWidgetCfg): void
  • A shortcut for createWidget.

    Parameters

    • widgetName: string

      Name of the widget class, as registered in PrimeFaces.widget.

    • widgetVar: string

      Widget variable of the widget

    • cfg: BaseWidgetCfg

      Configuration for the widget

    Returns void

  • debug(log: string): void
  • Logs the given message at the debug level.

    Parameters

    • log: string

      Message to log

    Returns void

  • Deletes the given cookie.

    Parameters

    • name: string

      Name of the cookie to delete

    • Optional cfg: Partial<export=.CookieAttributes>

      The cookie configuration used to set the cookie.

    Returns void

  • download(url: string, mimeType: string, fileName: string, cookieName: string): void
  • 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.

    Parameters

    • url: string

      URL pointing to the resource to download.

    • mimeType: string

      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.

    • fileName: string

      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.

    • cookieName: string

      Name of the file download cookie (by default primefaces.download). This function makes sure the cookie is set properly when the download finishes.

    Returns void

  • error(log: string): void
  • Logs the given message at the error level.

    Parameters

    • log: string

      Message to log

    Returns void

  • escapeClientId(id: string): string
  • 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

    Parameters

    • id: string

      ID to convert.

    Returns string

    A CSS ID selector for the given ID.

  • escapeHTML(value: string, preventDoubleEscaping: undefined | boolean): string
  • Escapes the given value to be used as the content of an HTML element or attribute.

    Parameters

    • value: string

      A string to be escaped

    • preventDoubleEscaping: undefined | boolean

      if true will not include ampersand to prevent double escaping

    Returns string

    The given value, escaped to be used as a text-literal within an HTML document.

  • escapeRegExp(text: string): string
  • Creates a regexp that matches the given text literal, and HTML-escapes that result.

    Parameters

    • text: string

      The literal text to escape.

    Returns string

    A regexp that matches the given text, escaped to be used as a text-literal within an HTML document.

  • focus(id?: string, context?: string): void
  • Attempts to put focus an element:

    • When id is given, puts focus on the element with that id
    • Otherwise, when context is given, puts focus on the first focusable element within that context (container)
    • Otherwise, puts focus on the first focusable element in the page.

    Parameters

    • Optional id: string

      ID of an element to focus.

    • Optional context: string

      The ID of a container with an element to focus

    Returns void

  • focusElement(el: JQuery<HTMLElement>): void
  • Puts focus on the given element.

    Parameters

    • el: JQuery<HTMLElement>

      Element to focus

    Returns void

  • getAriaLabel(key: string, defaultValue: string): string
  • Some ARIA attributes have a value that depends on the current locale. This returns the localized version for the given aria key.

    Parameters

    • key: string

      An aria key

    • defaultValue: string

      Optional default if key is not found

    Returns string

    The translation for the given aria key

  • getClosestForm(id: string): JQuery
  • 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.

    Parameters

    • id: string

      ID of the component to get the closest form or if its a form itself

    Returns JQuery

    the form or NULL if no form found

  • getCookie(name: string): string | undefined
  • Fetches the value of a cookie by its name

    Parameters

    • name: string

      Name of a cookie

    Returns string | undefined

    The value of the given cookie, or undefined if no such cookie exists

  • getFacesResource(name: string, library: string, version: string): string
  • Deprecated, use PrimeFaces.resources.getFacesResource instead.

    deprecated

    Parameters

    • name: string

      Name of the resource

    • library: string

      Library of the resource

    • version: string

      Version of the resource

    Returns string

    The URL for accessing the given resource.

  • getLocaleLabel(key: string): string
  • Attempt to look up the locale key by current locale and fall back to US English if not found.

    Parameters

    • key: string

      The locale key

    Returns string

    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.

    Parameters

    • Optional cfgLocale: string

      optional configuration locale from the widget

    Returns PrimeFaces.Locale

    The current locale with the key-value pairs.

  • getSelection(): string | Selection
  • Finds the text currently selected by the user on the current page.

    Returns string | Selection

    The text currently selected by the user on the current page.

  • getTheme(): string
  • Gets the currently loaded PrimeFaces theme.

    Returns string

    The current theme, such as omega or luna-amber. Empty string when no theme is loaded.

  • getThemeLink(): string
  • Gets the currently loaded PrimeFaces theme CSS link.

    Returns string

    The full URL to the theme CSS

  • Finds a widget in the current page with the given ID.

    Parameters

    • id: string

      ID of the widget to retrieve.

    Returns BaseWidget | null

    The widget with the given ID, of null if no such widget was found.

  • getWidgetsByType<TWidget>(type: TWidget): InstanceType<TWidget>[]
  • Finds all widgets in the current page that are of the given type.

    Type Parameters

    • TWidget extends (new (...args: never[]) => unknown)

      Type of the widgets of interest, e.g. PrimeFaces.widget.DataTable.

    Parameters

    • type: TWidget

      The (proto)type of the widgets of interest, e.g., PrimeFaces.widget.DataTable.

    Returns InstanceType<TWidget>[]

    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.

  • hasSelection(): boolean
  • Checks whether any text on the current page is selected by the user.

    Returns boolean

    true if text is selected, false otherwise.

  • inArray<T>(arr: T[], item: T): boolean
  • Checks whether an items is contained in the given array. The items is compared against the array entries via the === operator.

    Type Parameters

    • T = unknown

      Defaults to unknown. Type of the array items

    Parameters

    • arr: T[]

      An array with items

    • item: T

      An item to check

    Returns boolean

    true if the given item is in the given array, false otherwise.

  • info(log: string): void
  • Logs the given message at the info level.

    Parameters

    • log: string

      Message to log

    Returns void

  • invokeDeferredRenders(containerId: string): void
  • 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.

    Parameters

    • containerId: string

      ID of the container that may have become visible.

    Returns void

  • isDevelopmentProjectStage(): boolean
  • Checks whether the current application is running in a development environment or a production environment.

    Returns boolean

    true if this is a development environment, false otherwise.

  • isNumber(value: unknown): boolean
  • Checks whether a value is of type number and is neither Infinity nor NaN.

    Parameters

    • value: unknown

      A value to check

    Returns boolean

    true if the given value is a finite number (neither NaN nor +/- Infinity), false otherwise.

  • isProductionProjectStage(): boolean
  • Checks whether the current application is running in a production environment.

    Returns boolean

    true if this is a production environment, false otherwise.

  • monitorDownload(start: (() => void), complete: (() => void), monitorKey?: string): void
  • 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>

    Parameters

    • start: (() => void)

      Callback that is invoked when the download starts.

        • (): void
        • Returns void

    • complete: (() => void)

      Callback that is invoked when the download ends.

        • (): void
        • Returns void

    • Optional monitorKey: string

      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.

    Returns void

  • nextZindex(): string
  • 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.

    Returns string

    the next z-index as a string.

  • onElementLoad(element: JQuery<HTMLElement>, listener: (() => void)): void
  • 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.

    Parameters

    • element: JQuery<HTMLElement>

      Element to wait for

    • listener: (() => void)

      Listener to call once the element is loaded

        • (): void
        • Returns void

    Returns void

  • Deprecated, use PrimeFaces.dialog.DialogHandler.openDialog instead.

    deprecated

    Parameters

    Returns void

  • queueTask(fn: (() => void), delay: undefined | number): number | undefined
  • Queue a microtask if delay is 0 or less and setTimeout if > 0.

    Parameters

    • fn: (() => void)

      the function to call after the delay

        • (): void
        • Returns void

    • delay: undefined | number

      the optional delay in milliseconds

    Returns number | undefined

    the id associated to the timeout or undefined if no timeout used

  • removeDeferredRenders(widgetId: string): void
  • 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.

    Parameters

    • widgetId: string

      The ID of a deferred widget.

    Returns void

  • resetState(): void
  • Reset any state variables on update="@all".

    Returns void

  • scrollInView(container: JQuery<HTMLElement>, item: JQuery<HTMLElement>): void
  • Aligns container scrollbar to keep item in container viewport, algorithm copied from JQueryUI menu widget.

    Parameters

    • container: JQuery<HTMLElement>

      The container with a scrollbar that contains the item.

    • item: JQuery<HTMLElement>

      The item to scroll into view.

    Returns void

  • scrollTo(id: string, duration: undefined | string | number): void
  • Scrolls to a component with given client id

    Parameters

    • id: string

      The ID of an element to scroll to.

    • duration: undefined | string | number

      string or number determining how long the animation will run. Default to 400

    Returns void

  • setCaretToEnd(element: JQuery<HTMLElement>): void
  • Takes an input or textarea element and sets the caret (text cursor) position to the end of the the text.

    Parameters

    • element: JQuery<HTMLElement>

      An input or textarea element.

    Returns void

  • 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.

    Parameters

    • name: string

      Name of the cookie to set

    • value: string

      Value to set

    • Optional cfg: Partial<export=.CookieAttributes>

      Configuration for this cookie: when it expires, its paths and domain and whether it is secure cookie.

    Returns void

  • Deprecated, use {@link PrimeFaces.dialog.DialogHandler.showMessageInDialog} instead.

    deprecated

    Parameters

    Returns void

  • 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).

    Parameters

    • button: JQuery<HTMLElement>

      BUTTON element to skin

    Returns typeof PrimeFaces

    this for chaining

  • There are many Close buttons in PF that should get aria-label="close" and role="button".

    Parameters

    • element: JQuery<HTMLElement>

      BUTTON or LINK element

    Returns JQuery

    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).

    Parameters

    • input: JQuery<HTMLElement>

      INPUT element to skin

    Returns typeof PrimeFaces

    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).

    Parameters

    • select: JQuery<HTMLElement>

      SELECT element to skin

    Returns typeof PrimeFaces

    this for chaining

  • submit(formId: string, target?: string): void
  • Submits the given form, and clears all ui-submit-params 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.

    Parameters

    • formId: string

      ID of the FORM element.

    • Optional target: string

      The target attribute to use on the form during the submit process.

    Returns void

  • toISOString(date: Date): string
  • toSearchable(string: string, lowercase: boolean, normalize: boolean): string
  • Converts the provided string to searchable form.

    Parameters

    • string: string

      to normalize.

    • lowercase: boolean

      flag indicating whether the string should be lower cased.

    • normalize: boolean

      flag indicating whether the string should be normalized (accents to be removed from characters).

    Returns string

    searchable string.

  • trim(value: string): 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.

    Parameters

    • value: string

      the String to trim

    Returns string

    trimmed value or "" if it was NULL

  • updateFilledState(input: JQuery<HTMLElement>, parent: JQuery<HTMLElement>): void
  • Updates the class of the given INPUT element to indicate whether the element contains data or not. Used for example in floating labels.

    Parameters

    • input: JQuery<HTMLElement>

      The text input to modify

    • parent: JQuery<HTMLElement>

      The parent element of the input.

    Returns void

  • uuid(): string
  • 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.

    Parameters

    Returns boolean

    true if the request would not result in validation errors, or false otherwise.

  • version(): void
  • Logs the current PrimeFaces and jQuery version to console.

    Returns void

  • vi(element: string | HTMLElement | JQuery<HTMLElement>, highlight: boolean, renderMessages: boolean): boolean
  • A shortcut for PrimeFaces.validation.validateInstant. This is used by p:clientValidator.

    Parameters

    • element: string | HTMLElement | JQuery<HTMLElement>

      The ID of an element to validate, or the element itself.

    • highlight: boolean

      If the invalid element should be highlighted.

    • renderMessages: boolean

      If messages should be rendered.

    Returns boolean

    true if the element is valid, or false otherwise.

  • warn(log: string): void
  • Logs the given message at the warn level.

    Parameters

    • log: string

      Message to log

    Returns void

  • widgetNotAvailable(widgetVar: string): void
  • Handles the error case when a widget was requested that is not available. Currently just logs an error message.

    Parameters

    • widgetVar: string

      Widget variables of a widget

    Returns void

Generated using TypeDoc