Is there any possibility to sort activeadmin table using multiple columns?
I've found an issue that says it is impossible now. But I wonder if anyone has implemented such functionality?
I've faced same issue. Judging by source code this feature isn't supported
def sort_order(chain)
params[:order] ||= active_admin_config.sort_order
if params[:order] && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
column = $1
order = $2
table = active_admin_config.resource_table_name
table_column = (column =~ /\./) ? column :
"#{table}.#{active_admin_config.resource_quoted_column_name(column)}"
chain.reorder("#{table_column} #{order}")
else
chain # just return the chain
end
end
But there is monkey patch solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With