Element: <oj-refresher>

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class ojRefresher

QuickNav

Attributes

JET Custom Elements

JET components are implemented as custom HTML elements. In addition to the component attributes documented in this page, JET components also support standard HTML global attributes like id and aria-label.

The JET data binding syntax can be used to define both component and global attributes through the use of dynamically evaluated expressions. All attributes (component and global) support attribute-level binding by prefixing the attribute name with ":" (e.g. :id="[...]"). When using attribute-level binding, all expression values are treated as strings. Additionally, component attributes support property-level binding by using the attribute name directly with no ":" prefix. When using property-level binding, the expressions should evaluate to the types documented by the corresponding attributes. Property-level binding is strongly recommended over attribute-level binding for component attributes.

A detailed description of working with custom HTML elements can be found in: JET Custom Element Usage.



PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

Version:
  • 7.1.0
Since:
  • 5.1.0
Module:
  • ojrefresher

Module usage

See JET Module Loading for an overview of module usage within JET.

Typescript Import Format
//To typecheck the element APIs, import as below.
import {ojRefresher} from "ojs/ojrefresher";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojrefresher";

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.


JET Refresher

Description: A wrapper to provide pull-to-refresh functionality for a target DOM element

Warning: The pull to refresh gesture will not work with drag and drop enabled components. Drag and drop must be disabled in the component if use of pull to refresh is needed.

<oj-refresher id='myrefresher' threshold='100' text='Checking for updates' refresh-content='[[refreshFunc]]'>
   <oj-list-view id="listview"></oj-list-view>
</oj-refresher>

Styling

The following CSS classes can be applied by the page author as needed.

Class Description
oj-scroller Designates the element to be the scroller element used in place of the target.

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.

Attributes

refresh-content :function(): Promise.<*>

The function to invoke when the pull to refresh is triggered. Must return a Promise which will be resolved when the refresh function is completed.

Default Value:
  • null
Names
Item Name
Property refreshContent
Property change event refreshContentChanged
Property change listener attribute (must be of type function) on-refresh-content-changed

target :Element

The target to detect pull down. If no target is specified, then the wrapper will attempt to use the first child element with the 'oj-scroller' CSS style class applied to it. If no such element is found, then the first child element of the oj-refresher element will be used.

Default Value:
  • null
Names
Item Name
Property target
Property change event targetChanged
Property change listener attribute (must be of type function) on-target-changed

text :string

A text messsage shown in the pull-to-refresh panel after a pull down gesture.

Default Value:
  • ''
Names
Item Name
Property text
Property change event textChanged
Property change listener attribute (must be of type function) on-text-changed

threshold :number

The minimum distance in pixels that the user needs to pull down in order to trigger a refresh. If 0, then the threshold will default to the height of the target element.

Default Value:
  • 0
Names
Item Name
Property threshold
Property change event thresholdChanged
Property change listener attribute (must be of type function) on-threshold-changed

translations :object|null

A collection of translated resources from the translation bundle, or null if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.

If the component does not contain any translatable resource, the default value of this attribute will be null. If not, an object containing all resources relevant to the component.

If this component has translations, their documentation immediately follows this doc entry.

Names
Item Name
Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function) on-translations-changed

Label assigned to the refresh message to denote refresh complete that appears after triggering refresh content.

Default Value:
  • "Refresh complete"
Since:
  • 5.1.0
Names
Item Name
Property translations.ariaRefreshCompleteLink

Label assigned to the refresh link used for triggering refresh content when using keyboard or accessibility agents such as VoiceOver.

Default Value:
  • "Activate link to refresh content"
Since:
  • 5.1.0
Names
Item Name
Property translations.ariaRefreshLink

Label assigned to the refresh message to denote that the refresh is occuring that appears after triggering refresh content.

Default Value:
  • "Refreshing content"
Since:
  • 5.1.0
Names
Item Name
Property translations.ariaRefreshingLink

Methods

getProperty(property) → {any}

Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Since:
  • 4.0.0
Returns:
Type
any
Example

Get a single subproperty of a complex property:

let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');

refresh() → {void}

Refreshes the component.
Returns:
Type
void

setProperties(properties) → {void}

Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a batch of properties:

myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});

setProperty(property, value) → {void}

Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a single subproperty of a complex property:

myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");