Class: PullToRefreshUtils

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. PullToRefreshUtils

Version:
  • 3.2.0
Since:
  • 1.2.0
This class provides functions for adding pull to refresh functionality to any container element which hosts refreshable content. By default this class will generate default panel, which consists of the refresh icon, primary, and secondary text. The application can use the callback to provide their own panel. When the release happens, the refresh function will be invoked and application should use this to execute any logic required to refresh the content inside the panel. For example, fetching new cotent for the ListView inside the container. The application must resolve or reject the Promise so that this class can do the neccessary cleanup.

Touch End User Information

Target Gesture Action
Pull to refresh panel element Pan Shows the pull to refresh panel as user pan downward. Refresh action is triggered if the user pan downward over a specified threshold.

Keyboard End User Information

Target Key Action
Pull to refresh panel element Tab Shift focus to refresh action link.
Link Enter Invoke refresh action.

Constructor

new PullToRefreshUtils()

Source:

Methods

<static> setupPullToRefresh(element, refreshFunc, options)

Setup content container for pull to refresh capability. This method adds touch listeners on the content container. The following events are fired by this method: ojpull is fired when user pulls the content container, the event contains the content element as well as the distance pulled in pixels. ojrelease is fired when user releases the content container, the event contains the content element. ojcomplete is fired when the refresh is done and the panel is completely closed. The event contains the content element.
Parameters:
Name Type Argument Description
element Element the DOM element that hosts the content to refresh. When the content is scrollable, the value of this parameter must be the scrollable element. Specifically, when using this with ListView, the ListView element might not necessarily be the scrollable element, but is one of its ancestors instead.
refreshFunc function() the function to invoke when refresh is triggered. It must return a Promise.
options Object <optional>
optional values that controls aspects of pull to refresh
Properties
Name Type Description
threshold number the number of pixel to pull until refresh is triggered
primaryText string the primary text to display
secondaryText string the secondary text to display
Source:
See:

<static> tearDownPullToRefresh(element)

Removes the listener that was added in setupPullToRefresh. Page authors should call tearDownPullToRefresh when the content container is no longer needed.
Parameters:
Name Type Description
element Element the DOM element that hosts the content to refresh
Source:
See: