Forum: Ruby on Rails rjs problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
734a7bce0ec28ecc63ab0bc92cfa3182?d=identicon&s=25 Pawel Jur (pabloz)
on 2007-07-12 10:03
Hi guys!

I have a form and list of elements added through this form on the same
page. I am using rjs to add new elements, every new element is wrapped
in an html tag with
@element.dom_id (dom_id plugin) so i can also delete and edit using rjs.
I've also added a pagination using the plugin will_paginate. This part
works great.

I don't want to make rjs pagination(because of "back" button problems).
The problem is when i add another element (when i already have limited
number of elements on a page by will_paginate) the rjs will ofcourse add
another element to the top of element list and this will exeed the
number of elements that should be on the page at once.

What i want is rjs to remove the oldest element(lowest id of the element
on current page i guess) when the limit exceeds per page pagination
limit so the user will always see the right amount of elements on the
page.

thanks
703682e5658453d83f692fddb5607096?d=identicon&s=25 Sandeep Gudibanda (sgudibanda)
on 2007-11-13 11:48
Hi Pawel,

Any luck with the probelm. I am facing a similar situation.

Regards,
Sandeep G


Pawel Jur wrote:
> Hi guys!
>
> I have a form and list of elements added through this form on the same
> page. I am using rjs to add new elements, every new element is wrapped
> in an html tag with
> @element.dom_id (dom_id plugin) so i can also delete and edit using rjs.
> I've also added a pagination using the plugin will_paginate. This part
> works great.
>
> I don't want to make rjs pagination(because of "back" button problems).
> The problem is when i add another element (when i already have limited
> number of elements on a page by will_paginate) the rjs will ofcourse add
> another element to the top of element list and this will exeed the
> number of elements that should be on the page at once.
>
> What i want is rjs to remove the oldest element(lowest id of the element
> on current page i guess) when the limit exceeds per page pagination
> limit so the user will always see the right amount of elements on the
> page.
>
> thanks
This topic is locked and can not be replied to.