Hello, you can try this:
pagination_links(@prod_pages, { :params => @params})
Also, @items = @prods[offset..(offset + items_per_page - 1)] equal
with
@items = @prods[offset...(offset + items_per_page)]
:)
On 9 Фев., 08:34, Trupti Bhatt
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
>
> Here I have code to display a list of products to display. I use
> pagination to display them . 3 records are diaplyed on a single page.
> when I move to the next page I actually passes through the controller.
> there I want to access previous pages value.
>
> how to do it.
>
> the controller is
>
> def viewsearchitems
> @srchparams = params[:txt_srch].to_s
> @cnt = 1
> page = (params[:page] ||= 1).to_i
> tems_per_page = 3
> offset = (page - 1) * items_per_page
> @prods=RealEstate.find_by_sql("select * from real_estates order
> by id")
> @prod_pages = Paginator.new(self, @prods.length, items_per_page,
> page)
> @items = @prods[offset..(offset + items_per_page - 1)]
> end
>
> viewsearchitem.rhtml is
>
> <% if @items != nil %>
> <% for result in @items %>
> <tr>
> <td class="SrchTblTxt" align="center">
> <img src="/images<%= h(result.imgpath) %>"
height="50"
> width="50">
> </td>
> <td class="SrchTblTxt" align="center">
> <%= link_to result.id , :action =>
''dispitem'', :id => result %>
> </td>
> <td class="SrchTblTxt" align="center">
<%= result.address %>
> </td>
> <td class="SrchTblTxt" align="center">
<%= result.bedroom %>
> </td>
> <td class="SrchTblTxt" align="center">
<%= result.area %> </td>
> <td class="SrchTblTxt" align="center">
<%= result.price %>
> </td>
> </tr>
> <% end %>
> <% if @prod_pages.page_count > 1 %>
> <%= pagination_links @prod_pages %>
> <% end %>
> <% end %>
>
> if I have checkbox associate with each item in every page How do I get
> the status of the checkbox in each page when I move from one page to
> another
>
> --
> Posted viahttp://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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---