Class: DataGridDataSource

Oracle® JavaScript Extension Toolkit (JET)
4.2.0

E91398-01

QuickNav

oj. DataGridDataSource extends oj.DataSource

Version:
  • 4.2.0
The base class for DataGridDataSource.
DataGridDataSource implementations must implement all of the functions documented here.

Constructor

new DataGridDataSource()

Methods

fetchCells(cellRange, callbacks, callbackObjects) → {Object}

Fetch a range of cells from the data source.
Parameters:
Name Type Argument Description
cellRange Array.<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.

axis: the axis associated with this range where cells are fetched. Valid values are "row" and "column".
start: the start index of the range for this axis in which the cells are fetched.
count: count the size of the range for this axis in which the cells are fetched.

callbacks Object the callbacks to be invoke when fetch cells operation is completed. The valid callback types are "success" and "error".

success: the callback to invoke when fetch cells completed successfully.
error: the callback to invoke when fetch cells failed.

callbackObjects Object <optional>
the object in which the callback function is invoked on. This is optional. You can specify the callback object for each callbacks using the "success" and "error" keys.
Returns:
the range of cells
Type
Object

#fetchHeaders(headerRange, callbacks, callbackObjects) → {Object}

Fetch a range of headers from the data source.
Parameters:
Name Type Argument Description
headerRange Object information about the header range, it must contain the following properties: axis, start, count.

axis: the axis of the header that are fetched. Valid values are "row" and "column".
start: the start index of the range in which the header data are fetched.
count: count the size of the range in which the header data are fetched.

callbacks Object the callbacks to be invoke when fetch headers operation is completed. The valid callback types are "success" and "error".

success: success the callback to invoke when fetch headers completed successfully.
The function takes three paramaters: HeaderSet object representing start headers, headerRange object passed into the original fetchHeaders call, and a HeaderSet object representing the end headers along the axis.
error: error the callback to invoke when fetch cells failed.

callbackObjects Object <optional>
the object in which the callback function is invoked on. This is optional. You can specify the callback object for each callbacks using the "success" and "error" keys.
Returns:
the range of headers
Type
Object

#getCapability(feature) → {string|null}

Determines whether this DataGridDataSource supports certain feature.
Parameters:
Name Type Description
feature string 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". For "move", the valid return values are: "row", "none". Returns null if the feature is not recognized.
Type
string | null

#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
axis string the axis in which we inquire for the total count. Valid values are "row" and "column".
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
axis string the axis in which we inquire whether the total count is an estimate. Valid values are "row" and "column".
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

handleEvent(eventType, event) → {boolean}

Handle the event
Parameters:
Name Type Description
eventType string event type
event Object event
Inherited From:
Returns:
Returns false if event is cancelled
Type
boolean

#indexes(keys) → {Object}

Returns the row and column index based on the keys.
Parameters:
Name Type Description
keys Object the key for each axis

row: row the key for the row axis
column: the key for the column axis

Returns:
a Promise object which when resolved returns an object containing the index for each axis
Type
Object

Init() → {undefined}

Initializes the instance.
Inherited From:
Returns:
Type
undefined

#keys(indexes) → {Object}

Returns the keys based on the indexes.
Parameters:
Name Type Description
indexes Object the index for each axis

row: the index for the row axis
column: the index for the column axis

Returns:
a Promise object which when resolved returns an object containing the keys for each axis
Type
Object

#move(rowToMove, referenceRow, position, callbacks, callbackObjects) → {undefined}

Moves a row from one location to another.
Parameters:
Name Type Argument 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 string The position of the moved row relative to the reference row. Valid values are: "before", "after"
callbacks Object for the move function success: the callback to invoke when the move completed successfully.
error: the callback to invoke when move failed.
callbackObjects Object <optional>
the object in which the callback function is invoked on. This is optional. You can specify the callback object for each callbacks using the "success" and "error" properties.
Returns:
Type
undefined

#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 string The position of the moved row relative to the reference row. Valid values are: "before", "after".
Returns:
returns "valid" if the move is valid, "invalid" otherwise.
Type
string

off(eventType, eventHandler)

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 on method.

Parameters:
Name Type Description
eventType string eventType
eventHandler function(Object) event handler function
Inherited From:

on(eventType, eventHandler)

Attach an event handler.

Application can call this if it wants to be notified of an event. It can call the off method to detach the handler when it no longer wants to be notified.

Parameters:
Name Type Description
eventType string eventType
eventHandler function(Object) event handler function
Inherited From:

#sort(criteria, callbacks, callbackObjects) → {undefined}

Performs a sort on the data source.
Parameters:
Name Type Argument Description
criteria Object the sort criteria. Specifies null to reset sort state.

axis: The axis in which the sort is performed, valid values are "row", "column"
key: The key that identifies which header to sort
direction: the sort direction, valid values are "ascending", "descending", "none" (default)

callbacks Object the callbacks to be invoke upon completion of the sort operation. The callback properties are "success" and "error".

success: the callback to invoke when the sort completed successfully.
error: the callback to invoke when sort failed.

callbackObjects Object <optional>
the object in which the callback function is invoked on. This is optional. You can specify the callback object for each callbacks using the "success" and "error" properties.
Returns:
Type
undefined