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@googlegroups.com.
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.

Search Discussions

  • Mdfdroid at Oct 19, 2011 at 7:22 pm
    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@googlegroups.com.
    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.
  • CavalryJim at Oct 20, 2011 at 2:46 pm

    On Oct 19, 2:22 pm, mdfdroid 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@googlegroups.com.
    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.
  • Norbert Melzer at Oct 21, 2011 at 6:00 am
    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@gmail.com>:
    On Oct 19, 2:22 pm, mdfdroid 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@googlegroups.com.
    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.
    --
    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@googlegroups.com.
    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.
  • Mdfdroid at Oct 21, 2011 at 1:24 pm
    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 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...@gmail.com>:


    On Oct 19, 2:22 pm, mdfdroid 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@googlegroups.com.
    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.
    --
    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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 18, '11 at 10:11a
activeOct 21, '11 at 1:24p
posts5
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase