Created
February 16, 2010 00:55
-
-
Save bronson/305165 to your computer and use it in GitHub Desktop.
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
# minor improvement to http://blog.js.hu/2010/01/07/unobtrusive-jqgrid-on-rails-a-la-2dconcept-but-with-searchlogic/ | |
# (would have commented but blog.js.hu isn't sending me a registration email) | |
if params[:_search].present? | |
filters = {} | |
if params[:_search] == "true" | |
searchable_columns.each do |param| | |
filters["#{param}_like"] = params[param] if params[param].present? | |
end | |
end | |
if params[:sidx].present? | |
order = params[:sord] == "desc" ? "descend" : "ascend" | |
filters[:order] = "#{order}_by_#{params[:sidx]}" | |
end | |
finder = finder.search(filters) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment