Options
All
  • Public
  • Public/Protected
  • All
Menu

The interface for the object containing functionality related to sending AJAX requests.

Hierarchy

  • Request

Index

Methods

  • addFormData(formData: FormData, name: string, value: string | Blob, parameterPrefix?: string): void
  • Appends a request parameter to the given list of parameters. Optionally add a prefix to the name, this is used for portlet namespacing.

    Parameters

    • formData: FormData

      the form data to add to the form.

    • name: string

      Name of the new parameter to add.

    • value: string | Blob

      Value of the parameter to add.

    • Optional parameterPrefix: string

      Optional prefix that is added in front of the name.

    Returns void

  • addFormDataFromInput(formData: FormData, name: string, form: JQuery<HTMLElement>, parameterPrefix?: string): void
  • Adds a new request parameter to the given FormData. The value of the parameter is taken from the input element of the given form. The input element must have the same name as the name of the parameter to add. Optionally add a prefix to the name, which used for portlet namespacing.

    Parameters

    • formData: FormData

      The FormData.

    • name: string

      Name of the new parameter to add

    • form: JQuery<HTMLElement>

      An HTML FORM element that contains an INPUT element with the given name.

    • Optional parameterPrefix: string

      Optional prefix that is added in front of the name.

    Returns void

  • addParam<TValue>(params: RequestParameter<string, TValue>[], name: string, value: TValue, parameterPrefix?: string): void
  • Appends a request parameter to the given list of parameters. Optionally add a prefix to the name, this is used for portlet namespacing.

    Type Parameters

    • TValue = unknown

      Defaults to unknown. Type of the parameter value.

    Parameters

    • params: RequestParameter<string, TValue>[]

      List of parameters to which a new parameter is added.

    • name: string

      Name of the new parameter to add.

    • value: TValue

      Value of the parameter to add.

    • Optional parameterPrefix: string

      Optional prefix that is added in front of the name.

    Returns void

  • addParamFromInput(params: RequestParameter<string, unknown>[], name: string, form: JQuery<HTMLElement>, parameterPrefix?: string): void
  • Adds a new request parameter to the given list. The value of the parameter is taken from the input element of the given form. The input element must have the same name as the name of the parameter to add. Optionally add a prefix to the name, which used for portlet namespacing.

    Parameters

    • params: RequestParameter<string, unknown>[]

      List of request parameters to the new parameter is added.

    • name: string

      Name of the new parameter to add

    • form: JQuery<HTMLElement>

      An HTML FORM element that contains an INPUT element with the given name.

    • Optional parameterPrefix: string

      Optional prefix that is added in front of the name.

    Returns void

  • Adds a list of callback parameters to the given list. Optionally prepends a prefix to the name of each added parameter.

    Type Parameters

    • TValue = unknown

      Defaults to unknown. Type of the parameter values.

    Parameters

    • params: RequestParameter<string, TValue>[]

      List of callback parameters to which parameters are added.

    • paramsToAdd: RequestParameter<string, TValue>[]

      List of callback parameters to add.

    • Optional parameterPrefix: string

      Optional prefix that is added in front of the name of the added callback parameters.

    Returns void

  • Creates a new array with all parameters from the second array that are not in the first array. That is, removes all parameters from the second array whose name is equal to one of the parameters in the first array. The given input array are not modified.

    Type Parameters

    • TValue = unknown

      Defaults to unknown. Type of the parameter values.

    Parameters

    Returns RequestParameter<string, TValue>[]

    An list of parameters that are in the second array, but not in the first.

  • createFacesAjaxFormData(form: JQuery<HTMLElement>, parameterPrefix: string, source: string, process?: string, update?: string): FormData
  • Creates a FormData which can be used for a Faces AJAX request on the current view. It already contains all required parameters like ViewState or ClientWindow.

    Parameters

    • form: JQuery<HTMLElement>

      The closest form of the request source.

    • parameterPrefix: string

      The Portlet parameter namespace.

    • source: string

      The id of the request source.

    • Optional process: string

      A comma separated list of components which should be processed.

    • Optional update: string

      A comma separated list of components which should be updated.

    Returns FormData

    The newly created form data.

  • extractParameterNamespace(form: JQuery<HTMLElement>): null | string
  • Finds the namespace (prefix) for the parameters of the given form. This is required for Porlets as a Portlet contains multiple JSF views and we must only process and update the forms/inputs of the current view / application. Later the namespace is used for all post params.

    Parameters

    • form: JQuery<HTMLElement>

      An HTML FORM element.

    Returns null | string

    The namespace for the parameters of the given form, or null when the form does not specifiy a namespace.

  • Handles the given AJAX request, either by sending it immediately (if async is set to true), or by adding it to the AJAX queue otherwise. The AJAX queue ensures that requests are sent and handled in the order they were started. See also jsf.ajax.request.

    Parameters

    • cfg: Partial<PrimeFaces.ajax.Configuration>

      Configuration for the AJAX request to send, such as the HTTP method, the URL, and the content of the request.

    • Optional ext: Partial<ConfigurationExtender>

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

    Returns Promise<ResponseData<PrimeFacesArgs>>

    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.

  • Given an AJAX call configuration, resolves the components for the process or update search expressions given by the configurations. Resolves the search expressions to the actual components and returns a list of their IDs.

    Parameters

    • source: JQuery<HTMLElement>

      the source element.

    • cfg: Partial<PrimeFaces.ajax.Configuration>

      An AJAX call configuration.

    • type: "update" | "process"

      Whether to resolve the process or update expressions.

    Returns string[]

    A list of IDs with the components to which the process or update expressions refer.

  • Collects all process or update search expressions from the given AJAX call configuration and returns them as one search expression.

    Parameters

    • cfg: Partial<PrimeFaces.ajax.Configuration>

      An AJAX call configuration.

    • type: "update" | "process"

      Whether to resolve the process or update expressions.

    Returns string

    All process or update search expression from the given configuration.

  • Starts the given AJAX request immediately by sending the data to the server. Contrast with handle, which may queue AJAX requests, depending on how they are configured.

    Parameters

    • cfg: Partial<PrimeFaces.ajax.Configuration>

      Configuration for the AJAX request to send, such as the HTTP method, the URL, and the content of the request.

    Returns undefined | boolean

    false if the AJAX request is to be canceled, true or undefined otherwise.

Generated using TypeDoc