Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Inline sorting of Grids - see BookGrid for example, :sort_info => {

:sort=> :title, :dir => :desc }
  • Loading branch information...
commit dfc564381934c4592f4122494d404abe4621fc86 1 parent 157568f
@elser authored
View
5 lib/netzke/basepack/grid_panel/services.rb
@@ -206,6 +206,11 @@ def get_records(params)
assoc, method = c[:name].split('__')
relation = relation.includes(assoc.to_sym) if method
end
+
+ if config[:sort_info]
+ params[:sort] ||= config[:sort_info][:sort].to_s
+ params[:dir] ||= config[:sort_info][:dir]
+ end
# apply sorting if needed
if params[:sort]
View
1  test/rails_app/app/components/book_grid.rb
@@ -5,6 +5,7 @@ class BookGrid < Netzke::Basepack::GridPanel
def default_config
super.merge(
:model => "Book",
+ :sort_info => { :sort=> :title, :dir => :desc },
:persistence => true
)
end

0 comments on commit dfc5643

Please sign in to comment.
Something went wrong with that request. Please try again.