# Yahoo! UI Library

### DataTable Widget 2.5.1

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

Show Private Show Protected

## Class YAHOO.widget.Paginator.ui.CurrentPageReport

ui Component to generate the textual report of current pagination status. E.g. "Now viewing page 1 of 13".

### Constructor

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

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

### Properties

#### span `- private HTMLElement`

Span node containing the formatted info

### Methods

#### init

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

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

Returns: `void`

#### render

`HTMLElement render ( id_base )`
Generate the span containing info formatted per the pageReportTemplate attribute.

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

Returns: `HTMLElement`

#### sprintf

`static string sprintf ( template , values )`
Replace place holders in a string with the named values found in an object literal.

Parameters:
  `template <string>` The content string containing place holders
  `values <object>` The key:value pairs used to replace the place holders

Returns: `string`

#### update

`void update ( e )`
Regenerate the content of the span if appropriate. Calls CurrentPageReport.sprintf with the value of the pageReportTemplate attribute and the value map returned from pageReportValueGenerator function.

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

Returns: `void`

### Events

#### beforePageReportClassChange

`beforePageReportClassChange ( eventInfo )`
Fires before the value for the configuration attribute 'pageReportClass' 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.

#### beforePageReportTemplateChange

`beforePageReportTemplateChange ( eventInfo )`
Fires before the value for the configuration attribute 'pageReportTemplate' 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.

#### beforePageReportValueGenaratorChange

`beforePageReportValueGenaratorChange ( eventInfo )`
Fires before the value for the configuration attribute 'pageReportValueGenarator' 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.

#### pageReportClassChange

`pageReportClassChange ( eventInfo )`
Fires when the value for the configuration attribute 'pageReportClass' changes.

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

#### pageReportTemplateChange

`pageReportTemplateChange ( eventInfo )`
Fires when the value for the configuration attribute 'pageReportTemplate' changes.

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

#### pageReportValueGenaratorChange

`pageReportValueGenaratorChange ( eventInfo )`
Fires when the value for the configuration attribute 'pageReportValueGenarator' changes.

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

### Configuration Attributes

#### pageReportClass `- object`

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

#### pageReportTemplate `- object`

Used as innerHTML for the span. Place holders in the form of {name} will be replaced with the so named value from the key:value map generated by the function held in the pageReportValueGenerator attribute.
Default Value: '({currentPage} of {totalPages})'

#### pageReportValueGenarator `- object`

Function to generate the value map used to populate the pageReportTemplate. The function is passed the Paginator instance as a parameter. The default function returns a map with the following keys:

- currentPage
- totalPages
- startIndex
- endIndex
- startRecord
- endRecord
- totalRecords

Copyright © 2007 Yahoo! Inc. All rights reserved.