Constructor
new FlattenedTreeDataSource(treeDataSource, options)
Base class for FlattenedTreeDataGridDataSource and FlattenedTreeTableDataSource
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
treeDataSource |
Object | the instance of TreeDataSource to flattened | |
options |
Object |
<optional> |
the options set on the FlattenedDataSource |
Methods
-
collapse(rowKey)
-
Collapse the specified row.
Parameters:
Name Type Description rowKey
Object the key of the row to collapse - Source:
-
Destroy()
-
Destroy the data source.
-
expand(rowKey)
-
Expand the specified row.
Parameters:
Name Type Description rowKey
Object the key of the row to expand - Source:
-
#getCapability(feature) → {string|null}
-
Determines whether this data source supports certain feature.
Parameters:
Name Type Description feature
string the feature in which its capabilities is inquired. Currently the only valid feature is "sort". - Source:
Returns:
the name of the feature. For "sort", the valid return values are: "full", "none". 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 parent
Object the parent key. Specify null if inquiring child count of the root. - Source:
Returns:
the number of children for the specified parent.- Type
- number
-
getExpandedKeys() → {Array.<Object>|string}
-
Retrieves the expanded row keys
- Source:
Returns:
an array of expanded row keys or 'all' if all rows are expanded.- Type
- Array.<Object> | string
-
getOption(option) → {Object}
-
Retreives the value of the specified option.
Parameters:
Name Type Description option
string the option to retrieve the value. - Source:
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.
- Source:
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.
- Source:
Returns:
the underlying oj.TreeDataSource.- Type
- Object
-
handleEvent(eventType, event) → {boolean}
-
Handle the event
Parameters:
Name Type Description eventType
string event type event
Object event Returns:
Returns false if event is cancelled- Type
- boolean
-
Init()
-
Initializes the data source.
-
move(rowToMove, referenceRow, position)
-
Moves a row from one location to another (different position within the same parent or a completely different parent)
Parameters:
Name Type Description rowToMove
Object the key of the row to move referenceRow
Object the key of the reference row which combined with position are used to determine the destination of where the row should moved to. position
number | 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. callbacks.success
function() the callback to invoke when the move completed successfully. callbacks.error
function({status: Object}) the callback to invoke when move failed. - Source:
-
moveOK(rowToMove, referenceRow, position) → {string}
-
Checks whether a move operation is valid.
Parameters:
Name Type Description rowToMove
Object the key of the row to move referenceRow
Object the key of the reference row which combined with position are used to determine the destination of where the row should moved to. position
number | 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. - Source:
Returns:
returns "valid" if the move is valid, "invalid" otherwise.- Type
- string
-
off(eventType, eventHandler)
-
Detach an event handler
Parameters:
Name Type Description eventType
string eventType eventHandler
function(Object) event handler function - Inherited From:
- Source:
-
on(eventType, eventHandler)
-
Attach an event handler
Parameters:
Name Type Description eventType
string eventType eventHandler
function(Object) event handler function - Inherited From:
- Source:
Non-public Methods
-
<protected> _fetchRowsFromChildren(range)
-
Fetch a range of rows from the underlying TreeDataSource.
Parameters:
Name Type Description range
Object the range of rows to fetch. This is the range in a flattened view. Properties
Name Type Description start
number the start of the range in a flattened view count
number the number of rows to fetch - Source:
-
<protected> _fetchRowsFromDescendants(range)
-
Fetch a range of rows from the underlying TreeDataSource using the fetchDescendants method.
Parameters:
Name Type Description range
Object the range of rows to fetch. This is the range in a flattened view. Properties
Name Type Description start
number the start of the range in a flattened view count
number the number of rows to fetch - Source:
-
<protected> fetchRows(range)
-
Fetch a range of rows from the underlying data source. This is a convenient method that the subclasses should use to fetch from the underlying TreeDataSource. This method will take care of the index mapping between a flattened range to tree indexes.
Parameters:
Name Type Description range
Object the range of rows to fetch. This is the range in a flattened view. Properties
Name Type Description start
number the start of the range in a flattened view count
number the number of rows to fetch - Source:
-
<protected> getAncestors(rowKey) → {Array}
-
Returns the key of the ancestors.
Parameters:
Name Type Description rowKey
Object the row key to find the ancestors. - Source:
Returns:
an array of the key of the ancestors from root to the row with specified row key.- Type
- Array
-
<protected> getFetchedRange() → {Object}
-
Returns the currently fetched range.
- Source:
Returns:
the fetched range (start, end).- Type
- Object
-
<protected> getFetchSize() → {number}
-
Retrieves the fetch size
- Source:
Returns:
the fetch size- Type
- number
-
<protected> getIndex(rowKey) → {number}
-
Determine the flattened index for the specified key
Parameters:
Name Type Description rowKey
Object the key to find the index - Source:
Returns:
the index representing the specified key. Returns -1 if the index cannot be found.- Type
- number
-
<protected> getKey(index) → {Object|null}
-
Determines the key for the specified flattened index
Parameters:
Name Type Description index
number the index in flattened view - Source:
Returns:
the key for the specified index. Returns null if the index has not been fetched yet or is invalid.- Type
- Object | null
-
<protected> getMaxCount() → {number}
-
Retrieves the max count
- Source:
Returns:
the max count- Type
- number
-
<protected> handleExpandError(rowKey, status)
-
Callback method to handle fetch error on expand operation.
Parameters:
Name Type Description rowKey
Object the key of the expanded row status
Object the error status - Source:
-
<protected> handleExpandSuccess(rowKey, nodeSet, childCount, options)
-
Callback method to handle fetch success on expand operation.
Parameters:
Name Type Argument Description rowKey
Object the key of the expanded row nodeSet
Object the node set that describes the children of the expanded row childCount
number the total number of children the expanded row has options
Object <optional>
optional parameters to the method Properties
Name Type Argument Description queue
Object <optional>
a queue of expanded rows remaining to process (depth first traversal) prevNodeSetInfo.nodeSet
Object <optional>
the node set from a previous expand call prevNodeSetInfo.firstIndex
number <optional>
the ref index for the FIRST expand call, this is needed when firing the insert event, where the insertion point is the first index prevNodeSetInfo.firstKey
Object <optional>
the ref row key for the FIRST expand call, this is needed when firing the insert event, where the insertion point is the first row key - Source:
-
<protected> handleMaxCountReached(range, callbacks)
-
Handles what happened when the maximum row count has been reached.
Parameters:
Name Type Description range
Object the range of the fetch request which caused the max count to be reached. callbacks
Object the callbacks of the fetch request which caused the max count to be reached. - Source:
-
<protected> insertMetadata(key, metadata)
-
A hook for FlattenedTreeDataSource to inject additional metadata into the NodeSet
Parameters:
Name Type Description key
Object the row key identifying the row metadata
Object the existing metadata to inject into - Source:
-
<protected> insertRows(insertAtIndex, insertAtKey, nodeSet)
-
Abstract method to insert a set of rows into the DataGrid/Table
Parameters:
Name Type Description insertAtIndex
number the flattened index of the node where the rows are inserted. insertAtKey
Object the key of the node where the rows are inserted (the parent key) nodeSet
Object the node set containing data/metadata of inserted rows - Source:
-
<protected> refresh()
-
Refresh the data source. Clear out any state.
- Source:
-
<protected> removeRows(rowKeys)
-
Abstract method to remove the specified rows in the DataGrid/Table
Parameters:
Name Type Description rowKeys
Array.<Object> an array of keys of the rows to be remove. - Source: