简体   繁体   English

自定义页码Kaminari宝石

[英]Custom page number Kaminari gem

I am using Kaminari gem with my rails 3.2 application. 我在我的rails 3.2应用程序中使用Kaminari gem。 Its working fine. 它的工作正常。 Now i want to add a custom page number text field where user can provide a page number and by hitting return key should load the required page number. 现在,我想添加一个自定义页码文本字段,用户可以在其中提供页码,并通过按回车键应加载所需的页码。 What is the best approach to implement this functionality? 实现此功能的最佳方法是什么?

Each of the result pages differ in the parameter used for page . 每个结果页面的不同之处在于用于page的参数。

Eg: If the main url is http://www.my_site.com/my_list , the urls for the various pages would look as follows: 例如:如果主网址是http://www.my_site.com/my_list ,则各个页面的网址如下所示:

So you just need to set page=params[:required_page_number] to get the right page. 因此,您只需要设置page=params[:required_page_number]即可获取正确的页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM