API Docs for:
Show:

gallery-paginator-view Module

Available since 3.6.0

A Model class extension to be used to track "pagination state" of a paged set of control elements. For example, can be used to track the pagination status of a DataTable where the user selects limited portions for display, against a larger data set.

The primary tools for maintaining "page state" is through the following attributes;

  • totalItems    Which represents the "Total count of items of interest" (See attribute totalItems )
  • itemsPerPage    Which represents the "Count of items on each page" (See attribute itemsPerPage )
  • page    The currently selected page, within all pages required that encompass the above two attributes (See attribute page )

Usage

// setup a paginator model for 500 'foo' items, paged at 50 per page ...
var pagModel = new Y.PaginatorModel({
   totalItems:     500,
   itemsPerPage:   50
});
pagModel.get('totalPages');  // returns 10

pagModel.set('page',3);
pagModel.getAttrs(['lastPage','page','itemIndexStart','itemIndexEnd']);
// returns ... { lastPage:1, page:3, itemIndexStart:100, itemIndexEnd:149 }

This module provides the following classes: