开发者

Can the sortable_table plugin do order by multiple columns?

开发者 https://www.devze.com 2023-02-08 05:23 出处:网络
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

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"]
0

精彩评论

暂无评论...
验证码 换一张
取 消