开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜