views:

38

answers:

2

Hi

i am using will_paginate for pagination.

in this iam using images for clicking next and previous.

like, :prev_label & :next_label and it is working good

but, i want to add images to page numbers as well, and on clicking next it should roll over to next image.

Please give me solution for this

A: 

This example helps you

In Model

   @table_name = ModelName.paginate(:all, :page => params[:page], :per_page =>number_of_record)

In view use

<%= will_paginate  @table_name, :inner_window =>1, :outer_window   => -2 %>

and for image use paperclip plugin

A: 

For creating a custom paginator you need to subclass the WillPaginate::LinkRenderer class, and pass it as a parameter in your view, as

<%= will_paginate(@users, :renderer => MyCustomLinkRenderer) %>

Check this tutorial, or see the actual class definition to see how it gets rendered

Chubas