On Sat, Jan 17, 2009 at 3:05 AM, Ruhul Amin <
[email protected]> wrote:

>
> I want to use pagination with ajax. I have used will_paginate then add
> code to support ajax pagination.
> I have tried with partial with when I use the code
> in index.html.erb
> <div id="container">
>  <%= render :partial => 'contents' %>
> </div>
>
> Partial view: _contents.html.erb
> <%= will_paginate @collection, :renderer => 'RemoteLinkRenderer',
> :remote => {:update => 'container'} %>
>
> in controller the index action :
>  respond_to do |format|
>      format.html { render :partial => 'container' }
>      format.xml  { render :xml => @posts }
>    end
>
> and I am using the index action in the controller.
> It just show only the partial not the total page with the partial
> display.
>
> Please help me
>
In my controller, I have:

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @documents }
      format.js do
        render :update do |page|
          page.replace_html('documents_table',
                            :partial => 'documents_table',
                            :locals  => {:documents => @documents})
        end
      end
    end

In index.html.erb, I have

<div id="documents_table">
  <%= render :partial => 'documents_table', :locals => {:documents =>
@documents} %>
</div>

That way, when I first render the page, I get the total page, but when I
click on the page number links I just update the div with the data.

Hope this helps.

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to