Usage
Signature:
interface ItemMetadata<K>
Generic Parameters
Parameter Description K Type 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
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
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
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
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
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
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
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; });