-
-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiple sort field support in sort_link
This patch allows users to sort on multiple fields with the sort_link helper. To specify sorting on multiple fields: sort_link(:kind, [:kind, 'name asc']) This will create a sort link that sorts first by kind, and then by name. The first `:kind` parameter ensures that the link generated shows the sort status of the `kind` field. When you specify a sort direction in the sort fields array, the direction is locked to that direction. In the above example, clicking the resulting link would toggle sorting of the kind field, but the name field would always sort ascending. Also added was the ability to specify multiple default_order fields with a hash: sort_link(:kind, [:kind, :name], :default_order => { :name => 'asc', :kind => 'desc' }) Clicking the resulting link will toggle the sort directions of both `name` and `kind`, sorting the `name` field by default ascending, and the `kind` field descending.
- Loading branch information
Showing
2 changed files
with
182 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters