将 Paginate 链接范围分页

发布于 2024-11-15 02:07:01 字数 340 浏览 6 评论 0原文

我正在为我的 Rails3 项目使用 will_paginate 。 我有较小的宽度来显示分页范围链接结果。

我正在显示> 100 条记录,每页 8 条。 因此 will_paginate 链接显示为 1,2,3,4,5,6,7,8,9, .... 14,15 这超出了我的可用宽度。

我想展示的可能是从 1 到 5 然后...最后两页。 ( 1,2,3,4,5, .... 14 ,15 ) Will_Paginate 不接受任何参数来执行此类操作。

有没有人尝试过重写/调整此类方法来这样做? 或者欢迎对具有上述选项的任何其他分页提出建议!

i am using will_paginate for my rails3 project.
i have small width for showing the pagination range links result.

i'm showing > 100 records, 8 per page.
so the will_paginate links appear as 1,2,3,4,5,6,7,8,9, .... 14,15
which goes beyond my available width.

i want to show them may be from 1 to 5 then ... last two pages. ( 1,2,3,4,5, .... 14 ,15 )
Will_Paginate does not take any parameters for doing such thing.

Have anyone tried overriding / tweaking such methods for doing so ??
Or suggestion for any other pagination that has the above options are welcomed!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梨涡少年 2024-11-22 02:07:01

您应该能够使用 will_paginate 选项来完成此操作,例如:

will_paginate @collections, :inner_window => 2, :outer_window => 2

请参阅 文档will_paginate的

You should be able to do it using option for will_paginate, something like :

will_paginate @collections, :inner_window => 2, :outer_window => 2

See documention of will_paginate

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文