Usage
Javascript Import Format
define(['ojs/ojflattenedtreedatagriddatasource'], function(flattenedtreedatagriddatasource) { // Application should call API on flattenedtreedatagriddatasource.FlattenedTreeDataGridDataSource })
For additional information visit:
Final classes in JET
Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.
Properties:
| Name | Type | Argument | Description |
|---|---|---|---|
options.columns |
Array.<any> |
<optional> |
an array of columns to return as column headers |
options.expanded |
Array.<any> | string |
<optional> |
an array of the initial row keys that should be expanded, if all rows are expanded to start, specify the string 'all' |
options.rowHeader |
any | the key of the attribute designated as the row header |
Constructor
new FlattenedTreeDataGridDataSource(treeDataSource, options)
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
treeDataSource |
Object | the instance of TreeDataSource to flattened | |
options |
Object |
<optional> |
the options set on this data source |
Properties:
| Name | Type | Argument | Description |
|---|---|---|---|
options.columns |
Array.<any> |
<optional> |
an array of columns to return as column headers |
options.expanded |
Array.<any> | string |
<optional> |
an array of the initial row keys that should be expanded, if all rows are expanded to start, specify the string 'all' |
options.rowHeader |
any | the key of the attribute designated as the row header |
Methods
-
collapse(rowKey) : {undefined}
-
Collapse the specified row.
Parameters:
Name Type Description rowKeyany the key of the row to collapse - Inherited From:
Returns:
- Type
- undefined
-
Destroy : {undefined}
-
Destroy the data source.
- Inherited From:
Returns:
- Type
- undefined
-
expand(rowKey) : {undefined}
-
Expand the specified row.
Parameters:
Name Type Description rowKeyany the key of the row to expand - Inherited From:
Returns:
- Type
- undefined
-
fetchCells(cellRanges, callbacks, callbackObjects) : {undefined}
-
Fetch a range of cells from the data source.
Parameters:
Name Type Argument Description cellRangesArray.<Object> Information about the cell range. A cell range is defined by an array of range info for each axis, where each range contains three properties: axis, start, count. callbacksObject the callbacks to be invoke when fetch cells operation is completed. callbackObjectsObject <optional>
the object in which the callback function is invoked on. Properties:
Name Type Argument Description callbackObjects.errorObject <optional>
callbackObjects.successObject <optional>
callbacks.errorfunction({status: Object}):undefined the callback to invoke when fetch cells failed. callbacks.successfunction({cellSet: Object}, {cellRanges: Array.<Object>}):undefined the callback to invoke when fetch cells completed successfully. cellRanges.axisstring the axis associated with this range where cells are fetched. Valid values are "row" and "column". cellRanges.countnumber the size of the range for this axis in which the cells are fetched. cellRanges.startnumber the start index of the range for this axis in which the cells are fetched. Returns:
- Type
- undefined
-
fetchHeaders(headerRange, callbacks, callbackObjects) : {undefined}
-
Fetch a range of headers from the data source.
Parameters:
Name Type Argument Description headerRangeObject information about the header range, it must contain the following properties: axis, start, count. callbacksObject the callbacks to be invoke when fetch headers operation is completed. callbackObjectsObject <optional>
the object in which the callback function is invoked on. Properties:
Name Type Argument Description callbackObjects.errorObject <optional>
callbackObjects.successObject <optional>
callbacks.errorfunction({status: Object}):undefined the callback to invoke when fetch cells failed. callbacks.successfunction({startHeaderSet: Object}, {headerRange: Object}, {endHeaderSet: Object}):undefined the callback to invoke when fetch headers completed successfully. The function takes three parameters: HeaderSet object representing start headers, headerRange object passed into the original fetchHeaders call, and a HeaderSet object representing the end headers along the axis. headerRange.axisstring the axis of the header that are fetched. Valid values are "row" and "column". headerRange.countnumber the size of the range in which the header data are fetched. headerRange.startnumber the start index of the range in which the header data are fetched. Returns:
- Type
- undefined
-
getCapability(feature) : {string|null}
-
Determines whether this DataGridDataSource supports certain feature.
Parameters:
Name Type Description featurestring the feature in which its capabilities is inquired. Currently the only valid feature is "sort". Returns:
the name of the feature. For "sort", the valid return values are: "full", "none", "row", "column". Returns null if the feature is not recognized.
- Type
- string | null
-
getChildCount(parent) : {number}
-
Returns the number of children for a specified parent. If the value returned is not >= 0 then it is automatically assumed that the child count is unknown.
Parameters:
Name Type Description parentany the parent key. Specify null if inquiring child count of the root. - Inherited From:
Returns:
the number of children for the specified parent.
- Type
- number
-
getCount(axis) : {number}
-
Returns the total number of rows or columns. If the value return is not >= 0 then it is automatically assumed that the total count is unknown.
Parameters:
Name Type Description axisstring the axis in which we inquire for the total count. Returns:
the total number of rows/columns.
- Type
- number
-
getCountPrecision(axis) : {string}
-
Returns whether the total count returned in getCount function is an actual or an estimate.
Parameters:
Name Type Description axisstring the axis in which we inquire whether the total count is an estimate. Returns:
"exact" if the count returned in getCount function is the actual count, "estimate" if the count returned in getCount function is an estimate. The default value is "exact".
- Type
- string
-
getExpandedKeys : {Array.<Object>|string}
-
Retrieves the expanded row keys
- Inherited From:
Returns:
an array of expanded row keys or 'all' if all rows are expanded.
- Type
- Array.<Object> | string
-
getOption(option) : {Object}
-
Retrieves the value of the specified option.
Parameters:
Name Type Description optionstring the option to retrieve the value. - Inherited From:
Returns:
the value of the specified option. Returns null if the value is null or if the option is not recognized.
- Type
- Object
-
getSortCriteria : {Object}
-
Returns the current sort criteria of the tree data.
- Inherited From:
Returns:
the current sort criteria. It should contain the following properties: key, direction where criteria.key the key identifying the attribute (column) to sort on. Value is null if it's not sorted. criteria.direction the sort direction, valid values are "ascending", "descending", "none" (default)
- Type
- Object
-
getWrappedDataSource : {Object}
-
Retrieves the underlying TreeDataSource.
- Inherited From:
Returns:
the underlying oj.TreeDataSource.
- Type
- Object
-
handleEvent(eventType, event) : {boolean}
-
Handle the event
Parameters:
Name Type Description eventTypestring event type eventObject event - Inherited From:
Returns:
Returns false if event is canceled
- Type
- boolean
-
indexes(keys) : {Promise.<Object>}
-
Returns the row and column index based on the keys.
Parameters:
Name Type Description keysObject the key for each axis Properties
Name Type Description rowany the key for the row axis columnany the key for the column axis Returns:
a promise object containing the index for each axis, or null if not found
- Type
- Promise.<Object>
-
keys(indexes) : {Promise.<Object>}
-
Returns the keys based on the indexes.
Parameters:
Name Type Description indexesObject the index for each axis Properties:
Name Type Description indexes.columnObject the index for the column axis indexes.rowObject the index for the row axis Returns:
a Promise object which upon resolution will pass in an object containing the keys for each axis, or null if not found
- Type
- Promise.<Object>
-
move(rowToMove, referenceRow, position, callbacks) : {undefined}
-
Moves a row from one location to another (different position within the same parent or a completely different parent)
Parameters:
Name Type Argument Description rowToMoveany the key of the row to move referenceRowany the key of the reference row which combined with position are used to determine the destination of where the row should moved to. positionnumber | string The position of the moved row relative to the reference row. Valid values are: "before", "after". callbacksObject <optional>
the callbacks to be invoke upon completion of the move operation. Properties:
Name Type Description callbacks.errorfunction({status: Object}):undefined the callback to invoke when sort failed. callbacks.successfunction():undefined the callback to invoke when the sort completed successfully. Returns:
- Type
- undefined
-
moveOK(rowToMove, referenceRow, position) : {string}
-
Checks whether a move operation is valid.
Parameters:
Name Type Description rowToMoveany the key of the row to move referenceRowany the key of the reference row which combined with position are used to determine the destination of where the row should moved to. positionnumber | string The position of the moved row relative to the reference row. This can be a string: "before", "after", "inside", "first", "last", or the zero based index to position the element at a specific point among the reference row's current children. - Inherited From:
Returns:
returns "valid" if the move is valid, "invalid" otherwise.
- Type
- string
-
off(eventType, eventHandler) : {void}
-
Detach an event handler.
Application can call this if it no longer wants to be notified of an event that it has attached an handler to using the
onmethod.Parameters:
Name Type Description eventTypestring eventType eventHandlerfunction(Object) event handler function - Inherited From:
Returns:
- Type
- void
-
on(eventType, eventHandler) : {void}
-
Attach an event handler.
Application can call this if it wants to be notified of an event. It can call the
offmethod to detach the handler when it no longer wants to be notified.Parameters:
Name Type Description eventTypestring eventType eventHandlerfunction(Object) event handler function - Inherited From:
Returns:
- Type
- void
-
sort(criteria, callbacks, callbackObjects) : {undefined}
-
Performs a sort on the data source.
Parameters:
Name Type Argument Description criteriaObject | null the sort criteria. callbacksObject <optional>
the callbacks to be invoke upon completion of the sort operation. callbackObjectsObject <optional>
the object in which the callback function is invoked on. Properties:
Name Type Argument Description callbackObjects.errorObject <optional>
* @export callbackObjects.successObject <optional>
callbacks.errorfunction({status: Object}):undefined the callback to invoke when sort failed. callbacks.successfunction():undefined the callback to invoke when the sort completed successfully. criteria.axisstring The axis in which the sort is performed, valid values are "row", "column" criteria.directionstring the sort direction, valid values are "ascending", "descending", "none" (default) criteria.keyany The key that identifies which header to sort Returns:
- Type
- undefined