Class: PortletBase

(abstract) PortletBase()

Provides helper functions that simplify querying the DOM for elements related to a specific portlet.

Constructor

(abstract) new PortletBase()

Source:

Extends

  • Component

Members

namespace :string

Portlet's namespace.
Type:
  • string
Deprecated:
  • As of Judson (7.1.x)
Source:

portletNamespace :string

Portlet's namespace.
Type:
  • string
Source:

rootNode :Element

Portlet's root node element.
Type:
  • Element
Source:

Methods

all(selectors, rootopt) → {NodeList.<Element>}

Returns a Node List containing all the matching element nodes within the subtrees of the root object, in tree order. If there are no matching nodes, the method returns an empty Node List.
Parameters:
Name Type Attributes Description
selectors string A list of one or more CSS relative selectors.
root string | Element | Document <optional>
The root node of the search. If not specified, the element search will start in the portlet's root node or in the document.
Source:
Returns:
A list of elements matching the selectors, in tree order.
Type
NodeList.<Element>

fetch(urlnon-null, body) → {Promise}

Performs an HTTP POST request to the given URL with the given body.
Parameters:
Name Type Description
url string The URL to send the post request to.
body Object | FormData The request body.
Deprecated:
  • As of Athanasius (7.3.x), replaced by `Liferay.Util.fetch`.
Source:
Returns:
A promise.
Type
Promise

getRequestBody_(body) → {FormData}

Transforms the given body into a valid FormData element.
Parameters:
Name Type Description
body FormData | HTMLFormElement | Object The original data.
Source:
Returns:
The transformed form data.
Type
FormData

(protected) namespaceSelectors_(namespace, selectors) → {string}

Namespaces the list of selectors, appending the portlet namespace to the selectors of type ID. Selectors of other types remain unaltered.
Parameters:
Name Type Description
namespace string The portlet's namespace.
selectors string A list of one or more CSS relative selectors.
Source:
Returns:
The namespaced ID selectors.
Type
string

ns(obj) → {Object|string}

Appends the portlet's namespace to the given string or object properties.
Parameters:
Name Type Description
obj Object | string The object or string to namespace.
Source:
Returns:
An object with its properties namespaced, using the portlet namespace or a namespaced string.
Type
Object | string

one(selectors, rootopt) → {Element|null}

Returns the first matching Element node within the subtrees of the root object. If there is no matching Element, the method returns null.
Parameters:
Name Type Attributes Description
selectors string A list of one or more CSS relative selectors.
root string | Element | Document <optional>
The root node of the search. If not specified, the element search will start in the portlet's root node or in the document.
Source:
Returns:
A list of the first element matching the selectors or null.
Type
Element | null

(protected) rootNodeValueFn_() → {Element}

Returns the default portlet root node element. By default, this is the element with ID p_p_id{portletNamespace}.
Source:
Returns:
The portlet's default root node element.
Type
Element