Found this plugin to do the job. TinySort - http://www.sjeiti.com/?page_id=321

On Jun 5, 7:29 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
> Wrap that html in a <div id="hotels"> </div> and try this code
> triggered by a button or link.
>
> function reorder(sortby, direction)
> {
>         Array.prototype.sort.call($("div.hotel"), function(a,b){
>                 var av = $(a).find("span."+sortby).text();
>                 var bv = $(b).find("span."+sortby).text();
>                 return direction=="ascending"? av-bv : bv-av;
>         }).appendTo("#hotels");
>
> }
>
> sortby is the class name of any of the spans like distance or rate;
> direction is "ascending" (low to high) or "descending". The code
> assumes the spans should always be sorted as numeric values.
>
> That code should be plenty fast for a dozen or so entries, but it
> would get slow for 100 because it requeries for the span values on
> eachsortcomparison.

Reply via email to