Yahoo! UI Library

paginator  2.6.0

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

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

destroy

private void destroy ( )
Removes the link/span node and clears event listeners 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

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

beforePageReportTemplateChange

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

beforePageReportValueGenaratorChange

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

pageReportClassChange

pageReportClassChange ( event )
Fires when the value for the configuration attribute 'pageReportClass' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

pageReportTemplateChange

pageReportTemplateChange ( event )
Fires when the value for the configuration attribute 'pageReportTemplate' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

pageReportValueGenaratorChange

pageReportValueGenaratorChange ( event )
Fires when the value for the configuration attribute 'pageReportValueGenarator' changes.
Parameters:
event <{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 © 2008 Yahoo! Inc. All rights reserved.