i was wondering if it was possible to only affect one tab when clicking through pagination? im using the will_paginate gem
i have something that looks like…
<div class="tab-content">
<div class="tab-pane active span8" id="received">
<h3>Received Messages</h3>
<%= render 'received_message_feed'%>
</div>
<div class="tab-pane span8" id="sent">
<h3>Sent Messages</h3>
<%= render 'sent_message_feed'%>
</div>
</div>
which renders…
<% if @sent_message_items.any? %>
<ol class="microposts">
<%= render partial: 'shared/message_item', collection: @sent_message_items %>
</ol>
<%= will_paginate @sent_message_items %>
<% end %>
i have an equivalent received_message partial as well.
in my first block of code, i have 2 tabs, one for my received messages and one for my sent messages. lets say i click on my sent tab and then click on page 2. two problems arise from this.
-
the page refreshes and goes to my received messages tab, which is at first active tab. is there a way to make it go back to sent?
-
the bigger problem, when i click on page 2 while in sent tab, it will also load page 2 on my received tab. is there a way to prevent this?
im not sure how to fix this… help would be appreciated. thank you!
UPDATE.
i winded up using ajax pagination, so then the page doesn’t ever reload and problem 1 is circumvented. however problem 2 is still an issue…
i fixed it.
i winded up using ajax pagination, so then the page doesn’t ever reload and problem 1 is circumvented.
and as for problem 2, this saved the day
http://blog.devinterface.com/2011/08/tips-multiple-pagination-with-will_paginate/