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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 19, 2:22 pm, mdfdroid <mdfdr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
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 -- send by Samsung Galaxy Tab with Overcome Mod, so sorry for topposting. Am 20.10.2011 16:46 schrieb "CavalryJim" <james.davisphd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > On Oct 19, 2:22 pm, mdfdroid <mdfdr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. On Oct 21, 12:59 am, Norbert Melzer <timmel...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 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 > > -- > send by Samsung Galaxy Tab with Overcome Mod, so sorry for topposting. > Am 20.10.2011 16:46 schrieb "CavalryJim" <james.davis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > On Oct 19, 2:22 pm, mdfdroid <mdfdr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.