Skip to content

aldavidson/sortable_columns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SortableColumns
===============

A drop plugin for creating headers to easily sort a listing by any of it's columns.


Example
=======

./script/plugin install git://github.com/dlabare/sortable_columns.git

1) Add the sortable order to your .find, or .paginate

def index
  @blobs = Blob.all(:order => sortable_order(Blob))
end

2) Add the header links when listing your blobs.

<table>
  <tr>
    <th><%= link_to 'Name', sort_params(Blob, :name) %></th>
    <th><%= link_to 'Rank', sort_params(Blob, :rank) %></th>
  </tr>

  <% @blobs.each do |blob| %>
  <tr>
    <td><%= blob.name %></td>
    <td><%= blob.rank %></td>
  </tr>
  <% end %>
</table>

3) Profit.




Copyright (c) 2009 Daniel LaBare, released under the MIT license

About

Drop in support for one click sorting of your model's columns.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 100.0%