Forum OpenACS Development: Table sorting

Collapse
Posted by Gabriel Burca on
While ad_table and friends supports sorting, it involves a new request to the server with the associated delay even though the data to reorder is already available in the user's browser.

The following "trick" allows you to sort the data in place. It is by no means a replacement for SQL sorting, but can be used as a light-weight alternative on clients that have JS enabled. It only makes sense to use it when there's no pagination involved (i.e. all the rows are on the same page) or when the query used to extract the data is expensive.

One of the nice things about this is how trivial it is to make use of it.

Collapse
2: Re: Table sorting (response to 1)
Posted by Tom Jackson on

Nice for small datasets, but fails in practice. Usually sort by is used against all data, not just the original select set.

Collapse
3: Re: Table sorting (response to 1)
Posted by Jon Griffin on
My paginator does all this at the DB server level.
http://jongriffin.com/static/openacs/paginate/

It involves practically no overhead beyond your original query. and works in PG and Oracle.

This is being used in production for about a year with no problems. I haven't tested against 5.1 but it should work.