| Page 1 of 1 | [ 7 posts ] |
|
I'm using version 2.8 of the YUI Paginator in concert with the DataTable. I've been given the requirement to render different sets of pagination navigation widgets in the DataTable footer and header.
The footer pagination needs to look something like this: ![]() The header pagination needs to look something like this: ![]() I got the footer pagination working in pretty short order using a template and by overriding the default SAM classes (i.e. yui-pg-last, yui-pg-first). I don't know how to tackle the header pagination since multiple templates are not supported by the API. I somehow have to figure out how to make the Paginator.ui.PreviousPageLink and Paginator.ui.NextPageLink render differently depending on the container (header vs footer). As you can see from the screenshots, the Previous/Next page links in the footer don't use an image, but those links need to be rendered using an image in the header. The API documentation/examples didn't show an obvious way of achieving what I need. The closest I found was this example http://developer.yahoo.com/yui/examples/paginator/pag_manual_render.html in which the render event of the paginator is used to place different pagination widgets into different containers. But I don't see how to manually override the way the Previous/Next links are rendered depending on the container. I appreciate any help you guys can provide! |
|
Try the paginator.renderUIComponent( el, id_base ) method
http://developer.yahoo.com/yui/docs/YAH ... IComponent or the protected paginator._renderTemplate( container, template, id_base ) method http://developer.yahoo.com/yui/docs/YAH ... erTemplate You can pass any unique string as the id_base. The Paginator's default id_base is e.g. 'yui-pg0-1' for the second container (1) of the first Paginator on the page (pg0). HTH |
|
Thanks for the quick response. In general, how would one override a protected method such as _renderTemplate?
|
|
You shouldn't need to override it. Just call it with the container you want to populate and the template you want to vivify inside it. It need have no relation to the configured containers or template passed to the Paginator during construction.
But to your question, you override the method as you would any other method: myPaginator._renderTemplate = function () { /* do you're thing here */ }; |
|
private and protected members are just a naming convention: they start with an underscore. javaScript knows nothing about them, they are regular methods and can be overridden just line any other.
|
|
Ahh..makes perfect sense. Thanks again for your help.
|
|
Satyam,
This helps tremendously. As you can tell, I'm still trying to wrap my head around OO constructs in javascript. Thanks |
| Page 1 of 1 | [ 7 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© YUI Library - Site Credits
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group