Can the sortable_table plugin do order by multiple columns?
I'm using the sortable_table plugin fo开发者_C百科r sorting an HTML table in a Rails app.
If we want to order by multiple columns, can sortable_table plugin do it ? Example:
select distinct brands.title as brands, models.title as model
from brands, models
where
brands.id = models.brand_id
order by brands.title desc, models.title desc
Oh.. I get it!
Just put sortable_attributes on controller as array.
For example:
sortable_attributes :brand_model => ["brands.title", "models.title"]
精彩评论