Usage
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.
Constructor
new PagingTableDataSource(dataSource, options)
Parameters:
| Name | Type | Description |
|---|---|---|
dataSource |
Object | |
options |
Object | null | Options for the PagingTableDataSource. No option is currently supported. |
Fields
-
(static) EventType :string
-
Properties:
Name Type Default Description ADDstring add Triggered when a Row is added to a PagingDataSource CHANGEstring change Triggered when a Row's attributes have been changed ERRORstring error Triggered when an error occurred on the PagingDataSource REFRESHstring refresh Triggered when a PagingDataSource has been refreshed REMOVEstring remove Triggered when a Row is removed from a PagingDataSource REQUESTstring request Triggered when a PagingDataSource has sent a fetch request. RESETstring reset Triggered when a PagingDataSource is reset SORTstring sort Triggered when a PagingDataSource has been sorted SYNCstring sync Triggered when a PagingDataSource has been updated by a fetch -
sortCriteria :Object
-
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.
- Inherited From:
Properties:
Name Type Description criteria.direction'ascending' | 'descending' | 'none' the sort direction, valid values are "ascending", "descending", "none" (default) criteria.keyany The key that identifies which field to sort
Methods
-
_getPageFromStartIndex
-
* end delegated functions
-
at(index, options) : {Promise}
-
Return the row data found at the given index.
Parameters:
Name Type Argument Description indexnumber Index for which to return the row data. optionsObject <optional>
Options to control the at. Properties
Name Type Description fetchSizenumber fetch size to use if the call needs to fetch more records from the server, if virtualized. Overrides the overall fetchSize setting Returns:
Promise resolves to a compound object which has the structure below. If the index is out of range, Promise resolves to null.
data The raw row data index The index for the row key The key value for the row - Type
- Promise
-
fetch(options) : {Promise}
-
Fetch the row data.
Parameters:
Name Type Argument Description optionsObject <optional>
Options to control fetch Properties
Name Type Description startIndexnumber The index at which to start fetching records. silentboolean If set, do not fire a sync event. 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:
data An array of raw row data keys An array of key values for the rows startIndex The 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 idstring ID for which to return the row data, if found. optionsObject <optional>
Options to control the get. 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.
data The raw row data index The index for the row key The key value for the row - Type
- Promise
-
getCapability(feature) : {string|null}
-
Determines whether this TableDataSource 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". Returns null if the feature is not recognized.
- Type
- string | null
-
getEndItemIndex : {number}
-
Get the current page end index. If there are no rows in the current page then return -1.
Returns:
The current page end index
- Type
- number
-
getPage : {number}
-
Get the current page
Returns:
The current page
- Type
- number
-
getPageCount : {number}
-
Get the page count
Returns:
The total number of pages
- Type
- number
-
getStartItemIndex : {number}
-
Get the current page start index
Returns:
The current page start index
- Type
- number
-
getWrappedDataSource : {Object}
-
Retrieves the underlying DataSource.
Returns:
the underlying oj.DataSource.
- 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 cancelled
- Type
- boolean
-
Init : {undefined}
-
Initializes the instance.
- Inherited From:
Returns:
- Type
- undefined
-
off(eventType, eventHandler) : {void}
-
Detach an event handler from the datasource
Parameters:
Name Type Description eventTypestring eventType supported by the datasource eventHandlerfunction(Object) event handler function Returns:
- Type
- void
-
on(eventType, eventHandler) : {void}
-
Attach an event handler to the datasource
Parameters:
Name Type Description eventTypestring eventType supported by the datasource. In addition to this class's event types, it can also be one of the PagingModel event types.
eventHandlerfunction(Object) event handler function Returns:
- Type
- void
-
setPage(value, options) : {Promise}
-
Set the current page
Parameters:
Name Type Argument Description valuenumber The current page optionsObject <optional>
Options pageSize: The page size.
Returns:
promise object triggering done when complete..
- Type
- Promise
-
sort(criteria) : {Promise}
-
Performs a sort on the data source.
Parameters:
Name Type Description criteriaObject the sort criteria. Properties
Name Type Description keyObject The key that identifies which field to sort directionstring the sort direction, valid values are "ascending", "descending", "none" (default) Returns:
promise object triggering done when complete.
- Type
- Promise
-
totalSize : {number}
-
Return the total size of data available, including server side if not local.
Returns:
total size of data
- Type
- number
-
totalSizeConfidence : {('actual'|'estimate'|'atLeast'|'unknown')}
-
Returns the confidence for the totalSize value.
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
- ('actual'|'estimate'|'atLeast'|'unknown')