# Yahoo! UI Library

### DataTable Widget 2.5.0

Yahoo! UI Library > datatable > YAHOO.widget.Paginator.ui.PageLinks

Show Private Show Protected

## 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 onClick listener from the container in preparation for content removal.

Returns: `void`

#### init

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

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

Returns: `void`

#### 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

Returns: `void`

#### rebuild

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

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

Returns: `void`

#### 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

Returns: `HTMLElement`

#### update

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

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

Returns: `void`

### Events

#### beforeCurrentpageclassChange

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

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

#### beforePagelabelbuilderChange

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

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

#### beforePagelinkclassChange

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

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

#### beforePagelinksChange

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

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

#### beforePagelinkscontainerclassChange

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

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

#### currentPageClassChange

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

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

#### pageLabelBuilderChange

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

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

#### pageLinkClassChange

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

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

#### pageLinksChange

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

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

#### pageLinksContainerClassChange

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

Parameters:
  `eventInfo <{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 © 2007 Yahoo! Inc. All rights reserved.