I've used sorttable in the past. But, now that I use jQuery ...

function userSetup()
{
        ...

        $('#users_list .PaginationLinks a, #users_list thead .Actions
a').click(function()
        {
                showIndicator('#content');
                var href = $(this).attr('href');
                
                $.ajax({
                        url: href,
                        success: function(html)
                        {
                                hideIndicator();
                                
$('#users_list').fadeOut().html(html).fadeIn('slow');
                                userSetup();
                        }
                });
                return false;
        });
}

This handles the sort links (in .Actions) and the prev/next/page
links. The *Indicator functions are just a wrapper for the "loading"
img. I prefer rolling my own using jQuery as it gives me lots of
leeway in how the request is made, interface effects, etc.

The controller checks for an AJAX request. If it is, it sets the
layout to 'ajax' and renders the element instead of the entire view.
Easy as pie.

On Wed, May 13, 2009 at 9:00 AM, qwanta <[email protected]> wrote:
>
> I was looking for a way to sort a table without requerying the
> database for the data with a new ORDER clause.
>
> This javascript library I found did just that, so I thought I would
> share it.
>
> http://www.kryogenix.org/code/browser/sorttable/
>
> All you have to do is download sorttable.js and place in the webroot/
> js folder. Add a $javascript->link('sorttable', false); to the top of
> the view and add class='sortable' to the <table> tag.
>
> That's it! You should now be able to click on the column tables
> headers to sort. Usually this stuff never works painlessly, but this
> seems to be the rare case where it does.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to