有没有可能排序activeadmin
表使用多列?
我找到了一个issue https://github.com/gregbell/active_admin/issues/909也就是说现在这是不可能的。但我想知道有没有人实现过这样的功能?
我也遇到过同样的问题。判断依据源代码 https://github.com/gregbell/active_admin/blob/master/lib/active_admin/resource_controller/collection.rb#L43-L56不支持此功能
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 https://github.com/gregbell/active_admin/pull/1766#issuecomment-10450799猴子补丁解决方案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)