how to repaginate in an AJAX response?


look at rails ajax scaffold generator. Just use the scaffold generator
to make a simple page and then look at the code. it's quite easy to
figure out how it works when you can look at it. but it pretty hard to
explain. but I try.

You'll need something like a container (i.e. a table) which contains
all rows and only this container gets updated after an ajax request.
that means you will have an action which gets the current page from
pagination and render the container with this data. This will work
pretty good, but the bad thing about is, your going to send a lot of
unchanged data to the browser (i.e your pagination value is 10 and
your going to update one row, it will send 9 unchanged rows, too). So
you probably want to send as less data as possible. So you need to know
what has changed or which object has been destroyed. and then you will
update or remove the certain html parts of that object (i.e row in a
table). That means you will have to name each html object like
id='container-row-<%= "primarykey of the row "%>', you can make a
helper for this. with that you have a relation between your data and
the right part of the page.

I hope that will help you to get a little further