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 CollectionPagingDataSource(collection)
Parameters:
Name | Type | Description |
---|---|---|
collection |
Collection | the collection to use as source data for this paging control |
Methods
-
fetch(options) : {void|Promise<void|{data: Array<object>, startIndex: number}>}
-
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. Returns:
Promise object resolves to a compound object which contains an array of row data objects and the startIndex triggering done when complete.
The structure of the resolved compound object is:
data An array of raw row data startIndex The startIndex for the returned set of rows - Type
- void|Promise<void|{data: Array<object>, startIndex: number}>
-
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". 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
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
-
getWindow : {Array.<Object>}
-
Returns:
the current set of data in the paging window
- Type
- Array.<Object>
-
getWindowObservable : {KnockoutObservableArray<object>}
-
Returns:
an observable array representing the current data in the paging window
- Type
- KnockoutObservableArray<object>
-
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
-
Init
-
Initializes the instance.
-
off(eventType, eventHandler) : {void}
-
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:
Returns:
- Type
- void
-
on(eventType, eventHandler) : {void}
-
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:
Returns:
- Type
- void
-
setPage(value, options) : {Promise.<null>}
-
Set the current page
Parameters:
Name Type Argument Description value
number The current page options
Object <optional>
Options Properties
Name Type Argument Description pageSize
number <optional>
The page size. Returns:
promise object triggering done when complete..
- Type
- Promise.<null>
-
size : {number}
-
Returns:
size of data
- Type
- number
-
totalSize : {number}
-
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')