I want to apply multiple pagination with Kaminari via Ajax now here is my code for controller
def user_note
@user = current_user
@notes = Bookmark.where
I found this question searching for paginating multiple models on the same page. It's not clear to me how the pagination for the @notes collection is intended to work, but as presented, the solutions will only paginate the @bookmarks collection via AJAX.
There will be issues if you want to maintain pagination for both collections via html OR if you change the js file to render both collections.
I implemented a solution to my similar problem like this:
@notes
(including its pagination helper) and another that renders @bookmarks
with its pagination helperremote: true
One js view that re-renders the two partials, something like
$('#notes_container').html('<%= j(render partial: 'paginated_notes_list') %>');
$('#bookmarks_container').html('<%= j(render partial: 'paginated_bookmarks_list'); %>');
This is the key: Pagination links that take the current page of the other model as a parameter. This way you do not "lose" which page you are on in the other model.
<%= paginate @notes, param_name: 'page_1', params: {page_2: params[:page_2]} %>
<%= paginate @bookmarks, param_name: 'page_2', params: {page_1: params[:page_1]} %>
Again, I'm not really clear on how the asker's system is supposed to function, but this solution will allow user to page through both models without losing their "place" in the other model via AJAX or html.