Wil Paignate:上一个链接> 1 of 20 next link>

时间:2012-07-23 07:12:48

标签: ruby-on-rails ruby-on-rails-3 will-paginate

我喜欢显示我的分页记录,如下面的格式

上一个链接> 1 of 20 next link>

其中1代表第1页,20代表总页数。 如果我点击下一步然后我想显示下面的格式。 上一个链接> 2 of 20 next link>

我没有找到如何使用will_paginate在rails 3中获取它。

感谢您提供任何帮助。

2 个答案:

答案 0 :(得分:1)

尝试以下

<%= will_paginate @item, :page_links => false, 
                :separator =>"  #{@item.current_page} of #{@item.page_count}  "%>

O / P就像下面这样

« Previous 1 of 17 Next »

关注o / p

Previous link> 1 of 20 next link>

您必须执行以下操作

<%= will_paginate @item, :page_links => false, 
                :separator =>"  #{@item.current_page} of #{@item.page_count} ",
                :prev_label => "Previous link>", :next_label => "Next link>" %>

答案 1 :(得分:0)

您可以这样做:

<%= will_paginate @item, :previous_label => "Previous link", :next_label => "Next Link" %>

干杯!