Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6662365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:22:55+00:00 2026-05-26T02:22:55+00:00

I am using Ruby on Rails 3.1.0 , jquery-rails and WillPaginate gems in order

  • 0

I am using Ruby on Rails 3.1.0, jquery-rails and WillPaginate gems in order to paginate items via AJAX.

I am trying to keep check box checked statuses in an AJAX “paginated” view. That is, in a view it is displayed a list of items and (for performance reasons – since those items can be a lot) for those it is implemented pagination (10 items per page) so to have an output like the following:

# * `[ ]` represents a check box
# * `[X]` represents a checked check box
# * `Item<N>` represents a check box label
# * `Previous`, `Next`, `1`, `2`, `...` are WillPaginate links to switch
#    between pages

[X] Item1
[X] Item2
[X] Item3
[ ] Item4
[ ] ...
[ ] Item10

← Previous 1 2 3 Next →

Normally, when the user click on the Next link it happens that it is loaded and rendered (by performing an AJAX HTTP GET request) the next page including next 10 items. My problem is that if a user check some item (say Item1, Item2,Item3 have a status of checked) and then he\she switchs page those checked item statuses are lost. That is, when the user go back to the previous page then Item1, Item2,Item3 are not more checked (as well as it should be since I have not implemented nothing to keep them statuses).

I would like to keep checked statuses on switching pages. How can I do that? What approach do you advice to use (maybe Ruby on Rails session…)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:22:55+00:00Added an answer on May 26, 2026 at 2:22 am

    You could assign the entire DOM tree for the page to an array item (keyed by page number) when you leave it. Then when (if) your visitors go back to that page, you can load that straight back into the DOM from the array without an AJAX request, keeping your checkboxes as they were and making the page far snappier.

    This will work fine as long as the onclick listener for your checkboxes is on a DOM node that is further up the tree than the stuff you are swapping out. If that makes no sense, look up event bubbling – it rocks! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a auto complete box using ruby on rails, jquery
I'm using Ruby on Rails with jQuery and trying to do the following: <%=
I am using Ruby on Rails 3.0.9 and jQuery 1.6.2 I am trying to
I am trying to create a photo viewer in Ruby on Rails using jquery-lightbox
I am using jQuery and Ruby On Rails. I have an ajax call $.get()
I am using Ruby on Rails 3.0.10 and jQuery 1.6. I am trying to
I am using Ruby on Rails v3.0.9 and jQuery 1.6. I am trying to
I'm trying to write an app using Ruby on Rails and I'm trying to
I have a Ruby on Rails page that loads another page using jquery. I
I am using Ruby on Rails 3.0.7 and jQuery 1.6.1. I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.