will_paginate and checkboxes

Hi all, I am working on a project and I got excited to get pagination
and ajax working. I am using rails 3.1. What I have is a form for
creating a client, and inside that form i have a table that I have
implemented ajax, search, sort, and pagination following a railscasts
using will_paginate. The tables first column is a checkbox_tag for an
HABTM relationship. This is working great...until I really got
playing with it and I noticed that if you go to a new page or
something the value of the checked box is lost! So if I check a box
on page 1, then go to page 2 and hit create, only the item selected on
page 2 is saved.

Anyone have any info on how I can use jquery or something to keep the
checkboxes that are checked across multiple pages?? this is driving
me crazy.

Ok so I solved my problem by creating two divs on the page. A table
on the left that is paginated and has ajax search for assigning
issues. Then another table on the right that just shows assigned
issues. I have jquery watch for check box clicks and submit the
form. The form is submitted remotely and just re renders the two
divs. This way you can add issues by selecting them on the right, or
remove them by unchecking them on the right.

I had a similar problem with radio buttons and pagination. I used
jquery.dataTables to solve the problem.
With dataTables, you do not need will_paginate. The dataTable widget
handles all the pagination client side.

But if you handle the pagination client sided and have a table with a bazillion of entries then all the entries will be downloaded to the client bit your client will probably never go beyond the first couple of pages.

Just think of this in a mail application where you are viewing a folder with 10k mails in it.

In such cases I would really prefer some server side solution.

Who ever implements painted cheekbones should consider this when doing his specific solution.

Bye
Norbert

Cavalry thanks for the suggestion, but I think what Norbert says makes
sense to me. My table has over 120K entries. So i think there would
be an issue doing it in that way, but I will definitely remember
datagrids for my next project.