views:

26

answers:

3

This seems like a classic rails situation: I want to have a my index action display a sortable table of the items. I've looked at (and hacked at) some plugins, notably thoughbot's sortable_table and Michael Kovacs's sortable (the latter I have forked and improved). However, now I'm finding that sortable is somewhat incompatible with inherited_resources and I'm getting frustrated with fixing code that's not really being maintained.

And yet ... everyone must hit this need in their app, right?

So, what's the best solution? Does everyone roll their own? Is there a plugin I haven't heard of yet? Do people not bother with sortable tables? Is there some javascript/ajaxy thing I should be using instead? I'd love to find a better solution.

Update: should note that my database table is too big to load all of the rows, that would absolutely kill performance.

A: 

I like the YUI Data table. Articles and Support community

It can do client-side or server-side sorting, depending on your preference and data set size.

Can also be used for editing the data.

There are rails plugins for use with YUI Data table -- Google for "yui datatable rails" -- but I haven't tried any of them yet.

Larry K
+1  A: 

I've been using the jQuery DataTables plugin recently and have really been loving it. Small downside is that it requires you to load all of your row at once since it relies on Javascript, but it can then do some pretty fast and fancy pagination, filtering, and lots of other cool things.

I always hated sorting tables in Rails, this made it a lot easier.

Edit: As stated in my comments below, check out http://datatables.net/examples/data_sources/server_side.html if you want to do server side pagination/sorting. Fairly easy and this works great with a PHP project I'm currently working on as well :-)

Topher Fangio
I can't do this, the database table is huge.
sbwoodside
You can use DataTables for the UI/display and have it call out to your server for the pagination/sorting if you like. Check out http://datatables.net/examples/data_sources/server_side.html
Topher Fangio
thanks that looks like the best solution I can find...
sbwoodside
A: 

I use wice-grid, which is not only sortable, but can also be filtered, paginated, customised. I really like it ;)

nathanvda