Wednesday 29 September 2010

Changing the YUI Datatable Paginator CurrentPageReport

The CurrentPageReport controls the "(1 of 15)" text shown in the paginator.

This can be easily modified by overriding the template value.

Simply insert this after you have initialised your datatable.

// this goes after datatable is init'd
myDataTable.get("paginator").setAttributeConfig('pageReportTemplate',{
value : '{startIndex} to {endIndex} (of {totalRecords})',
validator : YAHOO.lang.isString
});


Here I have changed it to say "1 to 25 (of 2456)".

ie: it now shows records information rather than page information.

No comments:

Post a Comment