Rjs problem


#1

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


#2

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