Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Namespaces

Interfaces

Type aliases

Variables

Functions

Type aliases

Behavior

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

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

Type declaration

BindThis

BindThis<Base, ThisContext>: Base extends (...args: any) => any ? (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

BindThisAndSuper<Base, ThisContext>: Base extends (...args: any) => any ? (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

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

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

KeyValueTupleToObject<T>: {[ K in T[0]]: Extract<T, [K, any]>[1] }

Constructs an object type 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: [keyof any, any]

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

MatchingKeys

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.

Omit

Omit<T, K>: Pick<T, Exclude<keyof T, K>>

Construct a type with the properties of T except for those in type K.

Same as the builtin TypeScript type Omit, but repeated here to support slightly older TypeScript versions (3.4 and lower) that did not include it yet.

Type parameters

  • T

  • K: keyof any

PartialBy

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: keyof Base

    Type of the keys that are made optional.

PartialOrNull

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

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: { id: string | string[]; widgetVar: string }

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

PickMatching

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

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: Record<string, string>

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

ReturnOrVoid

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

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

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

Const BEHAVIOR_EVENT_PARAM

BEHAVIOR_EVENT_PARAM: string

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

Const CLIENT_ID_DATA

CLIENT_ID_DATA: string

Name of the POST parameter with the current client ID

Const CLIENT_WINDOW

CLIENT_WINDOW: string

Name of the POST parameter with the current client window.

Const IGNORE_AUTO_UPDATE_PARAM

IGNORE_AUTO_UPDATE_PARAM: string

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

Const PARTIAL_EVENT_PARAM

PARTIAL_EVENT_PARAM: string

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

Const PARTIAL_PROCESS_PARAM

PARTIAL_PROCESS_PARAM: string

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

Const PARTIAL_REQUEST_PARAM

PARTIAL_REQUEST_PARAM: string

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

Const PARTIAL_SOURCE_PARAM

PARTIAL_SOURCE_PARAM: string

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

Const PARTIAL_UPDATE_PARAM

PARTIAL_UPDATE_PARAM: string

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

Const RESET_VALUES_PARAM

RESET_VALUES_PARAM: string

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

Const RESOURCE_IDENTIFIER

RESOURCE_IDENTIFIER: string

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

Const SKIP_CHILDREN_PARAM

SKIP_CHILDREN_PARAM: string

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

Const VERSION

VERSION: string

The current version of PrimeFaces.

Const VIEW_ROOT

VIEW_ROOT: string

Name of the POST parameter that contains the view root.

Const VIEW_STATE

VIEW_STATE: string

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

Let animationActive

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.

Let animationEnabled

animationEnabled: boolean

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

Let confirmDialog

confirmDialog: ConfirmDialog | undefined

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

Let confirmSource

confirmSource: JQuery | undefined | null

The main container element of the source component that issued the confirmation request.

Let converter

converter: Record<string, Converter>

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

Let customFocus

customFocus: boolean

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

Let deferredRenders

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.

Const detachedWidgets

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.

Let entityMap

entityMap: Record<string, string>

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

Let locales

locales: Record<string, 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.

Let validator

validator: Record<string, Validator>

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

Let widgets

widgets: Record<string, BaseWidget>

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

Let zindex

zindex: number

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

Functions

ab

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

  • 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

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

    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

  • 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

  • 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

      The element for which to attach the behaviors.

    • behaviors: Record<string, (this: JQuery, event: TriggeredEvent) => 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

  • 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) => boolean | undefined)[]

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

    Returns void

bcnu

  • 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) => boolean | undefined)[]

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

    Returns void

calculateScrollbarWidth

  • 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

  • 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

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

    Returns void

closeDialog

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

    deprecated

    Parameters

    Returns void

confirm

cookiesEnabled

  • 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

  • createStorageKey(id: string, key: string): 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

    Returns string

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

createWidget

  • 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

  • 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

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

    Parameters

    • log: string

      Message to log

    Returns void

deleteCookie

  • Deletes the given cookie.

    Parameters

    • name: string

      Name of the cookie to delete

    • Optional cfg: Partial<CookieAttributes>

      The cookie configuration used to set the cookie.

    Returns void

download

  • 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

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

    Parameters

    • log: string

      Message to log

    Returns void

escapeClientId

  • 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

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

    Returns string

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

escapeRegExp

  • 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

  • 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

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

    Parameters

    Returns void

getAriaLabel

  • getAriaLabel(key: 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

    Returns string

    The translation for the given aria key

getCookie

  • 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

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

getLocaleSettings

  • getLocaleSettings(cfgLocale?: string): Locale
  • 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 Locale

    The current locale with the key-value pairs.

getSelection

  • 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

  • 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

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

    Returns string

    The full URL to the theme CSS

getWidgetById

  • 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

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

    Type parameters

    • TWidget: new (...args: any[]) => any

      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

  • 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

  • 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 = any

      Defaults to any. 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

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

    Parameters

    • log: string

      Message to log

    Returns void

invokeDeferredRenders

  • 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

  • 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

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

    Parameters

    • value: any

      A value to check

    Returns boolean

    true if the given value is a finite number, false otherwise.

monitorDownload

  • 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

  • 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

  • onElementLoad(element: JQuery, 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

      Element to wait for

    • listener: () => void

      Listener to call once the element is loaded

        • (): void
        • Returns void

    Returns void

openDialog

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

    deprecated

    Parameters

    Returns void

removeDeferredRenders

  • 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

scrollInView

  • Aligns container scrollbar to keep item in container viewport, algorithm copied from JQueryUI menu widget.

    Parameters

    • container: JQuery

      The container with a scrollbar that contains the item.

    • item: JQuery

      The item to scroll into view.

    Returns void

scrollTo

  • scrollTo(id: string): void
  • Scrolls to a component with given client id

    Parameters

    • id: string

      The ID of an element to scroll to.

    Returns void

setCaretToEnd

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

    Parameters

    • element: JQuery

      An input or textarea element.

    Returns void

setCookie

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

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

    Returns void

showMessageInDialog

skinButton

  • 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

      BUTTON element to skin

    Returns typeof PrimeFaces

    this for chaining

skinInput

  • 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

      INPUT element to skin

    Returns typeof PrimeFaces

    this for chaining

skinSelect

  • 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

      SELECT element to skin

    Returns typeof PrimeFaces

    this for chaining

submit

  • 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

  • toISOString(date: Date): string

trim

  • 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

  • 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

      The text input to modify

    • parent: JQuery

      The parent element of the input.

    Returns void

uuid

  • uuid(): string

vb

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

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

    Returns void

vi

  • A shortcut for PrimeFaces.validation.validateInstant. This is used by p:clientValidator.

    Parameters

    • element: string | HTMLElement | JQuery

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

    Returns boolean

    true if the element is valid, or false otherwise.

warn

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

    Parameters

    • log: string

      Message to log

    Returns void

widgetNotAvailable

  • 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