Describes a request to fetch only subset of records.
First and subsequent requests to single service can be distinguished. First time caller can specify only "pageSize" to indicates how many records should be returned. All other attributes are left blank.
Subsequent request can be more specific based on what is REST service capable of and how the service responded via PaginationCursor. For example if service returned "total" amount of records then subsequest requests can specify "offset" and "pageSize" within the range.
- Version:
- 17.1.1
- Source:
- See:
-
- PaginationCursor which holds an information coming from previous Operation.perform() call.
- Abcs.Operations().read(..) to use
PaginationRequest
from Application Builder custom code.
Methods
(static) createStandard(params) → {operation/js/api/PaginationRequest}
stable API
Creates an instance of PaginationRequest
.
You can pass an instance of PaginationRequest
into Abcs.Operations().read(..) method to fetch just
particular page of records from Application Builder custom code.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object | Object literal with all possible parameters. Properties
|
- Version:
- 17.1.1
- Source:
Returns:
Examples
PaginationRequest.createStandard({
pageSize: 30
});
PaginationRequest.createStandard({
offset: 15,
pageSize: 15
});
PaginationRequest.createStandard({
pageSize: 15,
totalResult: true
});
require([
'operation/js/api/PaginationRequest'
], function(PaginationRequest) {
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstPageRequest = PaginationRequest.createStandard({
pageSize: 15
});
var operation = Abcs.Operations().read({
entity: employee,
pagination: firstPageRequest
});
operation.perform().then(function(operationResult) {
if (operationResult.isSuccess()) {
// Process data from the first page any way you need
var paginationCursor = operationResult.getPaginationCursor();
var secondPageRequest = PaginationRequest.createStandard({
pageSize: 15,
cursor: paginationCursor
});
Abcs.Operations().read({
entity: employee,
pagination: secondPageRequest
}).perform().then(function(secondResult) {
// Process data from the second page any way you need
});
}
});
});