sachin238-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-10 10:15 UTC
Need help in Ajax Pagination
hi All, i wants to implement ajax pagination but i am facing a lot of problem , i found i lots of links on google but their is no explanation like what object we have to pass and condition can any body help me out in this concern pls i need your help as soon as possible thanks sachin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
sachin238-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> hi All, > > i wants to implement ajax pagination but i am facing a lot of > problem , i found i lots of links on google but their is no > explanation like what object we have to pass and condition can any > body help me out in this concern pls i need your help as soon as > possible > > thanks > sachinHI, With normal pagination code in controller you can use this code to perform pagination using Ajax. In following code use proper action name from controller in which you have done the pagination. <%if @photo_pages.current.previous%> <%= link_to_remote ("previous", :url=>{:action=>params[:redirect_action], :page =>@photo_pages.current.previous,:redirect_action=>params[:redirect_action],:id=>params[:id]})%> <%end%> <%if @photo_pages.current.next%> <%= link_to_remote ("next", :url=>{:action=>params[:redirect_action], :page => @photo_pages.current.next,:redirect_action=>params[:redirect_action],:id=>params[:id]})%> <%end%> Regards, kiran -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
R U using will_paginate? -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sijo Kg wrote:> R U using will_paginate?Hi, I am using normal pagination code in controller as @photo_pages ,@photos = paginate_collection @profile_user,:per_page => 16,:page => @params[:page] and in view using the code above specified. Regards, kiran -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Add the following code to view_helpers.rb .The file is in vendor/plugins/will_paginate/lib/will_paginate def page_link_or_span(page, span_class = ''current'', text = nil) text ||= page.to_s if page and page != current_page if update = @options[:update] @template.link_to_remote text, :update => update, :url => url_options(page) else @template.link_to text, url_options(page) end else @template.content_tag :span, text, :class => span_class end Then for ajax pagination in view do like <%= will_paginate @thecollectionyouwanttopaginate, :update=>''div'', :params=>{:controller=>''controller_name'',:action=>''action_name'',:any_additional_parameters=>@any_additional_parameters}, :container => false %> And for normal pagination do what you are currenly doing Sijo -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---