Archive for April, 2009

Sortable Tables

Posted in Programming with tags on April 29, 2009 by dialgforgerald

Rails has a helper function called sortable_element that generates ajax code to allow you to sort lists by dragging and dropping elements. The function defaults to handle lists and if you want to sort tables you should take note of the :tag option.

<%= sortable_element 'my_list',
:url => { :action => "order" },       
:tag => 'tr' %>

This should allow you to sort tables and hopefully save you from a big headache.

Advertisements