Class: FlattenedTreeDataProviderView

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class FlattenedTreeDataProviderView<K, D> implements DataProvider<K, D>

QuickNav


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

FlattenedTreeDataProviderView

Version:
  • 7.1.0
Since:
  • 7.0.0
Module:
  • ojflattenedtreedataproviderview

Module usage

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

Javascript Import Format
define(['ojs/ojflattenedtreedataproviderview'], function(FlattenedTreeDataProviderView) {
 // Application should call API on FlattenedTreeDataProviderView 
})
Typescript Import Format
//This class is exported directly as module. To import it
import FlattenedTreeDataProviderView= require("ojs/ojflattenedtreedataproviderview");

Generic Parameters
ParameterDescription
KType of output key
DType of output data

JET In Typescript

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

Description

Provides row expander optimizations for oj.TreeDataProvider by flattening the tree.

Events

Consumers can add event listeners to listen for the following event types and respond to data change.

mutate

This event is fired when items have been added or removed from the data.

Event payload is found under event.detail, which implements the oj.DataProviderMutationEventDetail interface.

refresh

This event is fired when the data has been refreshed and components need to re-fetch the data.

This event contains no additional event payload.

Example of consumer listening for the "mutate" event type:
var listener = function(event) {
  if (event.detail.remove) {
    var removeDetail = event.detail.remove;
    // Handle removed items
  }
};
dataProvider.addEventListener("mutate", listener);

Constructor

new FlattenedTreeDataProviderView(dataProvider, options)

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

Parameters:
Name Type Argument Description
dataProvider TreeDataProvider<K, D> the wrapped TreeDataProvider to flatten.
options Object <optional>
Properties
Name Type Argument Description
expanded KeySet.<K> <optional>
Optional key set to track the expansion state. To monitor the expansion state use the getExpandedObvservable method. To update the expansion state use the setExpanded method.

Methods

addEventListener(eventType: string, listener: EventListener): void

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

containsKeys(params: FetchByKeysParameters<K>): Promise<ContainsKeysResults<K>>

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

Check if there are rows containing the specified keys
Parameters:
Name Type Description
params oj.FetchByKeysParameters Fetch by keys parameters
Since:
  • 6.2.0
Returns:
Promise which resolves to oj.ContainsKeysResults
Type
Promise.<oj.ContainsKeysResults>

dispatchEvent(evt: Event): boolean

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

fetchByKeys(params: FetchByKeysParameters<K>): Promise<FetchByKeysResults<K, D>>

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

Fetch rows by keys
Parameters:
Name Type Description
params oj.FetchByKeysParameters Fetch by keys parameters
Since:
  • 6.2.0
Returns:
Promise which resolves to oj.FetchByKeysResults
Type
Promise.<oj.FetchByKeysResults>

fetchByOffset(params: FetchByOffsetParameters<D>): Promise<FetchByOffsetResults<K, D>>

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

Fetch rows by offset
Parameters:
Name Type Description
params oj.FetchByOffsetParameters Fetch by offset parameters
Since:
  • 4.2.0
Returns:
Promise which resolves to oj.FetchByOffsetResults
Type
Promise.<oj.FetchByOffsetResults>

fetchFirst(params?: FetchListParameters<D>): AsyncIterable<FetchListResult<K, D>>

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

Fetch the first block of data.
Parameters:
Name Type Argument Description
params oj.FetchListParameters <optional>
Fetch parameters
Since:
  • 6.2.0
See:
Returns:
AsyncIterable with oj.FetchListResult
Type
AsyncIterable.<oj.FetchListResult>

getCapability(capabilityName: string): any

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

Determines whether this DataProvider supports certain feature.
Parameters:
Name Type Description
capabilityName string capability name. Supported capability names are determined by the underlying dataprovider.
Since:
  • 6.2.0
Returns:
capability information or null if unsupported
Type
Object

getExpandedObservable():{ subscribe( subscriber : ((expanded: {value: KeySet<K>, completionPromise: Promise<any>}) => void) ): {unsubscribe(): void, closed(): boolean}}

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

Get the observable with information about the expanded state to subscribe to. Consumers can call subscribe and unsubscribe to receive changes to the expanded property.

On the first subscribe call, the initial value will be passed to the subscriber.

The observed value is an object with the following properties: value: KeySet - new expanded key set completionPromise?: Promise - resolved after all mutations have fired relevant to the expand/collapse. Example of consumer listening for the "mutate" event type:

expandedObserexpandedObservable = dataprovider.getExpandedObservable();
subscriber = expandedObservable.subscribe(function(detail){
 expanded = detail.value;
 promise = detail.completionPromise;
 // handle changes
});
// unsubscribe later
subscriber.unsubscribe();

See:
Returns:
an object to call subscribe on to receive changes to the expanded property. The subscribe function returns an object to call unsubscribe on.
Type
Object

getTotalSize() → {Promise.<number>}

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

Return the total number of rows in this dataprovider. Will return -1 if count cannot be determined.
Returns:
Returns a Promise which resolves to the total number of rows. -1 is unknown row count.
Type
Promise.<number>

isEmpty() → {"yes"|"no"|"unknown"}

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

Return a string that indicates if this data provider is empty
Returns:
a string that indicates if this data provider is empty. Valid values are: "yes": this data provider is empty. "no": this data provider is not empty. "unknown": it is not known if this data provider is empty until a fetch is made.
Type
"yes" | "no" | "unknown"

removeEventListener(eventType: string, listener: EventListener): void

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

setExpanded(keySet: KeySet<K>): void

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

Set a new expanded property on the FlattenedTreeDataProviderView.
Parameters:
Name Type Description
keySet KeySet the new key set representing expanded