On Dec 8, 2011, at 2:06 PM, Klaus Fuchs wrote:
> Hi,
>
> I''m trying to integrate a sorting method with will_paginate. I
like the
> sorttable.js for its simplicity but when I tried to integrate it with my
> ajax paginated lists it just works for the first page, others pages just
> can''t be sorted.
>
> If I use the regular pagination, it works for all pages.
>
> Have anyone had the same problem? If someone could suggest other sorting
> script/plugin/gem that would work with an ajax will_paginate version, it
> would be great.
I haven''t tried to do this, but from what you''re describing,
it sounds like the ajax pagination is replacing the elements that you intend to
sort. Sortable.create runs once to instantiate the sortable behavior on an
element and its children. Try moving the sortable call up a level into the same
partial you replace with your pagination call:
outer page
pagination controls/
paginated element
N x listed elements
(move your call to Sortable.create here)
/paginated element
pagination controls/
(it sounds like it''s currently located here)
/outer page
A call to Sortable.create on an element implicitly removes any existing Sortable
behavior from it. Removing or updating the children from within an
already-running sortable does not run that setup function again, so you have to
force it to run again.
Walter
>
> Thanks!
>
> --
> Posted via http://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-/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.
>
--
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.