# Yahoo! UI Library

### paginator 2.8.2r1

Yahoo! UI Library > paginator > YAHOO.widget.Paginator.ui.PageLinks
Search:
Filters
Show Private Show Protected Show Deprecated

## Class YAHOO.widget.Paginator.ui.PageLinks

ui Component to generate the page links

### Constructor

YAHOO.widget.Paginator.ui.PageLinks `( p )`

Parameters:
  `p <Pagintor>` Paginator instance to attach to

### Properties

#### container - `private HTMLElement`

Span node containing the page links

#### current - `private number`

Current page

### Methods

#### calculateRange

`static Array calculateRange ( currentPage , totalPages , numPages )`
Calculates start and end page numbers given a current page, attempting to keep the current page in the middle

Parameters:
  `currentPage <int>` The current page
  `totalPages <int>` (optional) Maximum number of pages
  `numPages <int>` (optional) Preferred number of pages in range

Returns: `Array`
  [start_page_number, end_page_number]

#### destroy

`private void destroy ( )`
Removes the page links container node and clears event listeners

#### init

`static void init ( p )`
Decorates Paginator instances with new attributes. Called during Paginator instantiation.

Parameters:
  `p <Paginator>` Paginator instance to decorate

#### onClick

`void onClick ( e )`
Listener for the container's onclick event. Looks for qualifying link clicks, and pulls the page number from the link's page attribute. Sends link's page attribute to the Paginator's setPage method.

Parameters:
  `e <DOMEvent>` The click event

#### rebuild

`void rebuild ( e )`
Force a rebuild of the page links.

Parameters:
  `e <CustomEvent>` The calling change event

#### render

`HTMLElement render ( id_base )`
Generate the nodes and return the container node containing page links appropriate to the current pagination state.

Parameters:
  `id_base <string>` used to create unique ids for generated nodes

#### update

`void update ( e )`
Update the links if appropriate

Parameters:
  `e <CustomEvent>` The calling change event

### Events

#### beforeCurrentPageClassChange

`beforeCurrentPageClassChange ( event )`
Fires before the value for the configuration attribute 'currentPageClass' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforePageLabelBuilderChange

`beforePageLabelBuilderChange ( event )`
Fires before the value for the configuration attribute 'pageLabelBuilder' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforePageLinkClassChange

`beforePageLinkClassChange ( event )`
Fires before the value for the configuration attribute 'pageLinkClass' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforePageLinksChange

`beforePageLinksChange ( event )`
Fires before the value for the configuration attribute 'pageLinks' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforePageLinksContainerClassChange

`beforePageLinksContainerClassChange ( event )`
Fires before the value for the configuration attribute 'pageLinksContainerClass' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### currentPageClassChange

`currentPageClassChange ( event )`
Fires when the value for the configuration attribute 'currentPageClass' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### pageLabelBuilderChange

`pageLabelBuilderChange ( event )`
Fires when the value for the configuration attribute 'pageLabelBuilder' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### pageLinkClassChange

`pageLinkClassChange ( event )`
Fires when the value for the configuration attribute 'pageLinkClass' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### pageLinksChange

`pageLinksChange ( event )`
Fires when the value for the configuration attribute 'pageLinks' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### pageLinksContainerClassChange

`pageLinksContainerClassChange ( event )`
Fires when the value for the configuration attribute 'pageLinksContainerClass' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

### Configuration Attributes

#### currentPageClass `- object`

CSS class assigned to the current page span.
Default Value: 'yui-pg-current-page'

#### pageLabelBuilder `- object`

Function used generate the innerHTML for each page link/span. The function receives as parameters the page number and a reference to the paginator object.
Default Value: function (page, paginator) { return page; }

#### pageLinkClass `- object`

CSS class assigned to each page link/span.
Default Value: 'yui-pg-page'

#### pageLinks `- object`

Maximum number of page links to display at one time.
Default Value: 10

#### pageLinksContainerClass `- object`

CSS class assigned to the span containing the page links.
Default Value: 'yui-pg-pages'

Copyright © 2010 Yahoo! Inc. All rights reserved.