简体   繁体   中英

How do i define multiple paginators for the same page on active admin?

I am trying to create a simple dashboard on active admin.

The idea here is to have multiple panels that serve as a quick view of different models. The problem is that when I move between pages it affects all paginators.

I am doing this

paginated_collection(my_collection.page(params[:page_2]).per(5)) do
   table_for collection do |t|
       ...
   end
end

Is it possible to have multiple paginators on active admin for the same page?

It is possible to set the name of the page param. This question is closely related to this answer: https://stackoverflow.com/a/6721703/790737 . ActiveAdmin wraps Kaminari, but will pass the param_name parameter to the pagination links. So I think you should be able to write:

paginated_collection(my_collection.page(params["custom_page_param"]).per(5), :param_name => 'custom_page_param') do
  table_for collection do |t|
     ...
  end
end

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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