Hello everyone, I am having an issue with the will_paginate gem, i have
recently added AJAX and JS to refresh the div with paginate without
refreshing the page.
I followed online examples and successfully got it working, however the
"previous" button and the first page are not shown as links, and can not
be clicked.
All other pages are in working order, and refreshes fine except the
first.

Controller:

def index
@tickets = Ticket.where('archived = ?', "False").where('closed = ?',
"False").order(sort_column + " " + sort_direction).paginate(:page =>
params[:page] || 1, :per_page => 12)

respond_to do |format|
format.html # index.html.erb
format.json { render json: @tickets }
format.js
end

end

View:

<div id="list">
<%= render :partial => 'customerList' %>
</div>

<%= will_paginate @tickets, :previous_label => "&larr; Previous",
:next_label => "Next &rarr;" %>

<script>
$(document).ready(function() {
$('.paginate a').attr('data-remote', 'true');
});</script>

Index.js.erb:

$('#list').html('<%=escape_javascript render :partial => "customerList"
%>');
$('.paginate a').attr('data-remote', 'true');



If anyone could shine some light on why this issue is occuring, I'd
really appreciate it.
Thanks!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMar 28, '13 at 3:15p
activeMar 28, '13 at 3:47p
posts5
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase