Class: JsonTreeDataSource

Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)

E54107-01

QuickNav

oj. JsonTreeDataSource

Constructor

new JsonTreeDataSource(data)

A json object based implementation of the TreeDataSource.
Parameters:
Name Type Description
data Object the json object
Source:

Methods

_createTreeDataSource(target, source, depth)

Returns tree based structure/object from json data.
Parameters:
Name Type Argument Description
target Object the final tree structure.
source Object the json object.
depth number <optional>
used recursively for depth calculation.
Source:

fetchChildren(parentKey, range, callbacks, options)

Fetch the children
Parameters:
Name Type Argument Description
parentKey Object the parent key. Specify null if fetching children from the root.
range Object information about the range, it must contain the following properties: start, count.
Properties
Name Type Description
start number the start index of the range in which the children are fetched.
count number the size of the range in which the children are fetched.
callbacks Object the callbacks to be invoke when fetch children operation is completed. The valid callback types are "success" and "error".
Properties
Name Type Description
success function(oj.JsonNodeSet) the callback to invoke when fetch completed successfully.
error function({status: Object}) the callback to invoke when fetch children failed.
options Object <optional>
optional parameters for this operation.
Properties
Name Type Argument Description
queueOnly boolean <optional>
true if this fetch request is to be queued and not execute yet. The implementation must maintain the order of the fetch operations. When queueOnly is false/null/undefined, any queued fetch operations are then flushed and executed in the order they are queued. This flag is ignored if the datasource does not support batching.
Source:

fetchDescendents(parentKey, callbacks, maxCount)

Fetch all children and their children recursively from a specified parent.
Parameters:
Name Type Argument Description
parentKey Object the parent key. Specify null to fetch everything from the root (i.e. expand all)
callbacks Object the callbacks to be invoke when fetch children operation is completed. The valid callback types are "success" and "error".
Properties
Name Type Description
success function(oj.JsonNodeSet) the callback to invoke when fetch completed successfully.
error function({status: Object}) the callback to invoke when fetch children failed.
maxCount number <optional>
the maximum number of children to fetch. If a non-positive number is specified, then the value is ignored and there is no maximum fetch count.
Source:

getCapability(feature) → {string|null}

Determines whether this TreeDataSource supports the specified feature.
Parameters:
Name Type Description
feature string the feature in which its capabilities is inquired. Currently the valid features "sort", "move", "fetchDescendents", "batchFetch"
Source:
Returns:
the name of the feature. Returns null if the feature is not recognized. For "sort", the valid return values are: "default", "none". For "fetchDescendents", the valid return values are: "enable", "disable", "suboptimal". For "move", the valid return values are: "default", "none". For "batchFetch", the valid return values are: "enable", "disable".
Type
string | null

getChildCount(parentKey) → {number|null}

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
parentKey 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 | null

Init()

Initial the json object based data source.
Source:

move(nodeToMove, referenceNode, position)

Moves a node from one location to another (different position within the same parent or a completely different parent)
Parameters:
Name Type Description
nodeToMove null | string the key of the node to move
referenceNode null | string the key of the reference node which combined with position are used to determine the destination of where the node should moved to.
position number | string The position of the moved node relative to the reference node. 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 node'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:

sort(criteria)

Performs a sort operation on the tree data.
Parameters:
Name Type Description
criteria Object the sort criteria. It must contain the following properties: key, direction
Properties
Name Type Description
key Object the key identifying the attribute (column) to sort on {string} criteria.direction the sort direction, valid values are "ascending", "descending", "none" (default)
callbacks.success function() the callback to invoke when the sort completed successfully.
callbacks.error function({status: Object}) the callback to invoke when sort failed.
Source: