DataTable.Paginator Class
yui3/src/datatable/js/paginator.js:425
Parent Module: datatable
Available since 3.11.0
Index
Methods
- _afterDataChangeWithPaginator
- _afterDataUpdatesWithPaginator
- _afterPaginatorModelChange
- _afterRowsPerPageChange
- _augmentData
- _defPageSizeVal
- _getConstructor
- _initPaginatorStrings
- _paginatorRender
- _paginatorRenderUI
- _setPageSizesFn
- _setPaginatorModel
- _uiPgHandler
- firstPage
- initializer
- lastPage
- nextPage
- previousPage
Methods
_afterDataChangeWithPaginator
()
protected
After the data changes, we ensure we are on the first page and the data is augmented
_afterDataUpdatesWithPaginator
-
e
After data has changed due to a model being added, removed, or changed, update paginator model totalItems to reflect the changes.
Parameters:
_afterPaginatorModelChange
-
[e]
Augments the model list with a paged structure, or updates the paged data. Then fires reset on the model list.
Parameters:
-
[e]
EventFacade optional
_afterRowsPerPageChange
-
e
After the rowsPerPage changes, update the UI to reflect the new number of
rows to be displayed. If the new value is null
, destroy all instances
of the paginators.
Parameters:
_augmentData
()
protected
Augments the model list data structure with paged implementations.
The model list will contain a method for getPage
that will return the
given number of items listed within the range.
each
will also loop over the items in the page
_defPageSizeVal
()
protected
Returns an Array with default values for the Rows Per Page select option. We had to use a valueFn to enable language string replacement.
_getConstructor
-
type
Returns a pointer to an object to be instantiated if the provided type is a string
Parameters:
-
type
Object | StringType of Object to contruct. If
type
is a String, we assume it is a namespace off the Y object
Returns:
_initPaginatorStrings
()
protected
Initializes paginatorStrings used for internationalization
_paginatorRender
()
protected
Renders the paginator into locations and attaches events.
_paginatorRenderUI
()
protected
Parse each location and render a new view into each area.
_setPageSizesFn
-
val
Ensures pageSizes
value is an array of objects to be used in the
paginator view.
Parameters:
-
val
Array
Returns:
Array
_setPaginatorModel
-
model
Ensures the object provided is an instance of a Y.Model
. If it is not,
it assumes it is the configuration of a model, and gets the new model
type from paginatorModelType
.
Parameters:
-
model
Model | Object
Returns:
Y.Model instance
_uiPgHandler
-
e
Handles the paginator's UI event into a single location. Updates the
paginatorModel
according to what type is provided.
Parameters:
firstPage
()
chainable
Sets the paginatorModel
to the first page.
initializer
()
protected
Constructor logic
lastPage
()
chainable
Sets the paginatorModel
to the last page.
nextPage
()
chainable
Sets the paginatorModel
to the next page.
previousPage
()
chainable
Sets the paginatorModel
to the previous page.
Attributes
pageSizes
Array
Array of values used to populate the values in the Paginator UI allowing the end user to select the number of items to display per page.
Default: [10, 50, 100, { label: 'Show All', value: -1 }]
paginatorLocation
String | Array | Node
String of footer
or header
, a Y.Node, or an Array or any combination
of those values.
Default: footer
paginatorModel
Model | Object
A model instance or a configuration object for the Model.
Default: null
paginatorModelType
Model | String
A pointer to a Model object to be instantiated, or a String off of the
Y
namespace.
This is only used if the paginatorModel
is a configuration object or
is null.
Default: 'DataTable.Paginator.Model'
paginatorView
View | String
A pointer to a Y.View
object to be instantiated. A new view will be
created for each location provided. Each view created will be given the
same model instance.
Default: 'DataTable.Paginator.View'
rowsPerPage
Number | null
Number of rows to display per page. As the UI changes the number of pages to display, this will update to reflect the value selected in the UI
Default: null