Interface: ItemMetadata

Oracle® JavaScript Extension Toolkit (JET)
12.1.0

F52696-01

Since:
  • 4.1.0
Module:
  • ojdataprovider

QuickNav

Fields

Description

Defines the item metadata objects in FetchListResult#metadata, FetchByKeysResults#results, and FetchByOffsetResults#results. Note that key is the only mandatory property.

In addition to the properties defined here, implementations can provide additional properties as needed.


Usage

Signature:

interface ItemMetadata<K>

Generic Parameters
ParameterDescription
KType of Key
Typescript Import Format
//To use this interface, import as below.
import {ItemMetadata} from "ojs/ojdataprovider";

For additional information visit:


Fields

(nullable) indexFromParent :number

Optional metadata for the zero-based index of the item relative to its parent if the DataProvider represents flattened hierarchical data. Currently used by flat components (table) using the FlattenedTreeDataProviderView and oj.ojRowExpander.
Since:
  • 12.0.0
Example

Getting the indexFromParent from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const indexFromParentArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.indexFromParent;
});

(nullable) isLeaf :boolean

Optional metadata for whether or not the item is a leaf node if the DataProvider represents flattened hierarchical data. Currently used by flat components (table) using the FlattenedTreeDataProviderView and oj.ojRowExpander.
Since:
  • 12.0.0
Example

Getting the isLeaf from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const isLeafArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.isLeaf;
});

key :K

The key for the row
Since:
  • 4.1.0
Example

Getting the keys from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const keyArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.key;
});

(nullable) message :ItemMessage

An optional message such as error associated with the row
Since:
  • 9.0.0
Example

Getting the messages from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const messageArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.message;
});

(nullable) parentKey :K

Optional metadata for the parent key for the item if the DataProvider represents flattened hierarchical data. Currently used by flat components (table) using the FlattenedTreeDataProviderView and oj.ojRowExpander.
Since:
  • 12.0.0
Example

Getting the parentKey from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const parentKeyArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.parentKey;
});

(nullable) suggestion :SuggestionMetadata

An optional suggestion metadata object that allows implementations to provide information related to suggestions.

The presence of this property in the item metadata indicates that the item is related to suggestion. This property should not be set if the item is not suggestion-related.

It is up to the consumers to decide how this information is used. For example, a component may decide to render items that are suggestions first before rendering all items in the normal order.

Since:
  • 12.0.0
Example

Getting the suggestions from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const suggestionArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.suggestion;
});

(nullable) treeDepth :number

Optional metadata for the zero-based depth of the item if the DataProvider represents flattened hierarchical data. Currently used by flat components (table) using the FlattenedTreeDataProviderView and oj.ojRowExpander.
Since:
  • 12.0.0
Example

Getting the treeDepth from ItemMetadata of fetchByOffset results

const result = await dataprovider.fetchByOffset({size: 5, offset: 2});
const items = result.results;
const dataArray = items.map((item) => {
  return item.data;
});
const treeDepthArray = items.map((item) => {
  const metadata = item.metadata;
  return metadata.treeDepth;
});