# Paginator
Inherits from: RHObject
The Paginator
class simplifies the paging of data. For example:
RecArray recs = ... // some large RecArray
Frame paginator = $RHCore.Paginator.New(recs)
paginator.setPageSize(20)
paginator.setPageNumber(4)
Dynamic pagedItems = pagintator.items()
The class also provides useful methods to assist with the generation of a paging widget.
paginator.count() // returns the total number of items
paginator.pageSize() // returns the
paginator.currentPageSize() // returns the number of items on the current page
paginator.pageCount() // returns the number of pages
paginator.hasPrevious() // returns true if there is a previous page
paginator.hasNext() // returns true if there is a next page
# Class Methods
# Inherited methods
# New
function Frame New(Dynamic items, Integer pageNumber=1, Integer pageSize=.fDefaultPageSize, Frame obj=Undefined)
# Overrides:
New
in class RHObject
# Instance Methods
# Property Methods
Property methods can be accessed with the valueForKey
method.
classidentifier classname clone columnnames count currentpagesize endindex errorassoc exists first hash hasnext hasotherpages hasprevious identityhashcode ispagingenabled items iterator last methods modelinstance nextpagenumber okassoc pagecount pagenumber pagerange pagesize pagesizes precache previouspagenumber propertymethods reset serialize startindex string toexcel values_list
# Inherited methods
assert cacheMethod cacheValueForKey callSuper checkError class classIdentifier className clone deserialize dict endTrans identityHashCode isAccessorMethod isCached isInstanceOf isProperty isPropertyMethod methods pluck prepareForReuse propertyMethods removeFromCache reset resetCache respondsTo serialize setCacheValueForKey setValueForKey setValueForKeyPath startTrans super valueForKey valueForKeyPath
# columnNames
function List columnNames()
Returns the column names.
# Returns
The colunn names as a List.
# count
function Integer count()
# currentPageSize
function Integer currentPageSize()
# endIndex
function Integer endIndex()
# exists
function Boolean exists()
# filter
function Frame filter(String keyPath, String op, Dynamic value, Dynamic extra=Undefined)
# filterIfDefined
function Frame filterIfDefined(String key, String op, Dynamic value, Dynamic extra=Undefined)
# first
function Dynamic first(String fieldName=Undefined)
# hash
function String hash()
# Overrides:
hash
in class RHObject
# hasNext
function Boolean hasNext()
# hasOtherPages
function Boolean hasOtherPages()
# hasPrevious
function Boolean hasPrevious()
# isPagingEnabled
function Boolean isPagingEnabled()
# items
function Dynamic items()
# iterator
function Frame iterator()
# Overrides:
iterator
in class RHObject
# last
function Dynamic last(Dynamic fieldName=Undefined)
# modelInstance
function Frame modelInstance()
# nextPageNumber
function Integer previousPageNumber()
# order_by
function Frame order_by(Dynamic fieldNames)
This function exists to be compatible with the sort filter in templates.
# pageCount
function Integer pageCount()
# pageNumber
function Integer pageNumber()
# pageRange
function List pageRange(Integer pageNumber=.pageNumber(), Integer pageCount=.pageCount(), Integer blockSize=4)
This function can also be called as a static function.
# pageSize
function Integer pageSize()
# pageSizes
function List pageSizes()
# precache
function Frame precache(String pkfieldname=Undefined, String keyTableName=Undefined, Dynamic items=Undefined)
This function used to be defined on RHTableQuery. However, in some situations our RHTableQuery might be replaced by a paginator in the template. When this happens the .precache() call breaks. This has been moved here to keep the interface consistent (despite it not doing anything).
# previousPageNumber
function Integer previousPageNumber()
# resetSubclass
function Void resetSubclass()
# Overrides:
resetSubclass
in class RHObject
# setLimit
function Frame setLimit(Integer limit)
# setObject
function Frame setObject(Dynamic obj)
# setOffset
function Frame setOffset(Integer offset)
You must call this after .setLimit() or .setPageSize().
The offset is 0-based.
# setPageNumber
function Frame setPageNumber(Dynamic pageNumber)
This should always be called last when setting up a paginator.
# setPageSize
function Frame setPageSize(Integer pageSize)
# setPaging
function Frame setPaging(Boolean enabled=true)
# setSort
function Frame setSort(Dynamic fieldNames)
# setValues
function Frame setValues(Dynamic items)
# Overrides:
setValues
in class RHObject
# sort
function Frame sort(Dynamic fieldNames)
# startIndex
function Integer startIndex()
# string
function String string()
This method returns a string
representation of the object.
# Overrides:
string
in class RHObject
# toExcel
function String toExcel(List columnNames=.columnNames(), String sheetName="Sheet1")
# values_list
function List values_list()
@abstract