Class: ArrayTableDataSource

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

Fields

oj. ArrayTableDataSource extends oj.TableDataSource

Version:
  • 3.2.0
Object representing data used by table component

Constructor

new ArrayTableDataSource(data, options)

Parameters:
Name Type Description
data Array | Object | function():Array data supported by the components
options Object | null Array of options for the TableDataSource
Source:

Fields

comparator

If set to a function(row1, row2), then this function is called comparing raw row data (see the JavaScript array.sort() for details)
Source:

sortCriteria :{Object} criteria the sort criteria.

The sort criteria. Whenever sort() is called with the criteria parameter, that value is copied to this property. If sort() is called with empty sort criteria then the criteria set in this property is used.
Properties:
Name Type Description
criteria.key Object The key that identifies which field to sort
criteria.direction string the sort direction, valid values are "ascending", "descending", "none" (default)
Source:

Methods

#add(m, options) → {Promise}

Add a row (or array of rows) to the end
Parameters:
Name Type Argument Description
m Object Row object data (or array of rows) to add. These should be sets of attribute/values.
options Object <optional>
silent: if set, do not fire an add event

at: splice the new row at the value given (at:index). If an array of rows then this should be an array of indexes

Source:
Returns:
Promise object resolves to a compound object which contains an array of row data objects, an array of keys, and an array of indexes which were added triggering done when complete.

The structure of the resolved compound object is:

dataAn array of raw row data
keysAn array of key values for the rows
indexesAn array of index values for the rows
Type
Promise

#at(index, options) → {Promise}

Return the row data found at the given index.
Parameters:
Name Type Argument Description
index number Index for which to return the row data.
options Object <optional>
Options to control the at.
Properties
Name Type Description
fetchSize number fetch size to use if the call needs to fetch more records from the server, if virtualized. Overrides the overall fetchSize setting

Source:
Returns:
Promise resolves to a compound object which has the structure below. If the index is out of range, Promise resolves to null.

dataThe raw row data
indexThe index for the row
keyThe key value for the row
Type
Promise

#change(m, options) → {Promise}

Change a row (or array of rows), if found.
Parameters:
Name Type Argument Description
m Object Row object data (or array of rows) to change. These should be sets of attribute/values.
options Object <optional>
silent: if set, do not fire a change event

Source:
Returns:
Promise object resolves to a compound object which contains an array of row data objects, an array of keys, and an array of indexes which were changed triggering done when complete.

The structure of the resolved compound object is:

dataAn array of raw row data
keysAn array of key values for the rows
indexesAn array of index values for the rows
Type
Promise

#fetch(options) → {Promise}

Fetch the row data.
Parameters:
Name Type Argument Description
options Object <optional>
Options to control fetch
Properties
Name Type Description
startIndex number The index at which to start fetching records.
silent boolean If set, do not fire a sync event.
Source:
Returns:
Promise object resolves to a compound object which contains an array of row data objects, an array of ids, and the startIndex triggering done when complete.

The structure of the resolved compound object is:

dataAn array of raw row data
keysAn array of key values for the rows
startIndexThe startIndex for the returned set of rows
Type
Promise

#get(id, options) → {Promise}

Return the first row data whose id value is the given id
Parameters:
Name Type Argument Description
id string ID for which to return the row data, if found.
options Object <optional>
Options to control the get.
Source:
Returns:
Promise which resolves to a compound object which has the structure below where the id matches the given id. If none are found, resolves to null.

dataThe raw row data
indexThe index for the row
keyThe key value for the row
Type
Promise

#getCapability(feature) → {string|null}

Determines whether this TableDataSource 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

handleEvent(eventType, event) → {boolean}

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

#Init()

Initializes the instance.
Source:

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:

#remove(m, options) → {Promise}

Remove a row (or array of rows), if found.
Parameters:
Name Type Argument Description
m Object Row object data (or array of rows) to remove. These should be sets of attribute/values.
options Object <optional>
silent: if set, do not fire a remove event
Source:
Returns:
Promise object resolves to a compound object which contains an array of row data objects, an array of keys, and an array of indexes which were removed triggering done when complete.

The structure of the resolved compound object is:

dataAn array of raw row data
keysAn array of key values for the rows
indexesAn array of index values for the rows
Type
Promise

#reset(data, options) → {Promise}

Remove and replace the entire list of rows with a new set of rows, if provided. Otherwise, empty the datasource. The next fetch call will re-populate the datasource with the original array data. To empty out the data, call reset with an empty array.
Parameters:
Name Type Argument Description
data Object <optional>
Array of row objects with which to replace the data.
options Object <optional>
user options, passed to event
Source:
Returns:
promise object triggering done when complete.
Type
Promise

#sort(criteria) → {Promise}

Performs a sort on the data source.
Parameters:
Name Type Description
criteria Object | null the sort criteria.
Properties
Name Type Description
key Object The key that identifies which field to sort
direction string the sort direction, valid values are "ascending", "descending", "none" (default)
Source:
Returns:
promise object triggering done when complete.
Type
Promise

#totalSize() → {number}

Return the total size of data available, including server side if not local.
Source:
Returns:
total size of data
Type
number

#totalSizeConfidence() → {string}

Returns the confidence for the totalSize value.
Inherited From:
Source:
Returns:
"actual" if the totalSize is the time of the fetch is an exact number "estimate" if the totalSize is an estimate "atLeast" if the totalSize is at least a certain number "unknown" if the totalSize is unknown
Type
string