Method: ActiveAdmin::Views::TableFor::Column#sort_key
- Defined in:
- lib/active_admin/views/components/table_for.rb
#sort_key ⇒ Object
Returns the key to be used for sorting this column
Defaults to the column’s method if its a symbol
column :username
# => Sort key will be set to 'username'
You can set the sort key by passing a string or symbol to the sortable option:
column :username, sortable: 'other_column_to_sort_on'
180 181 182 183 184 185 186 187 |
# File 'lib/active_admin/views/components/table_for.rb', line 180 def sort_key # If boolean or nil, use the default sort key. if @options[:sortable].nil? || @options[:sortable] == true || @options[:sortable] == false sort_column_name else @options[:sortable].to_s end end |