Question

J'utilise sortable_table plug-in pour table de tri html rails app.

Si nous voulons à l'ordre par plusieurs colonnes, peut le faire sortable_table plug-in? Exemple:

    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
Était-ce utile?

La solution

Oh .. je comprends!

Il suffit de mettre sortable_attributes sur le contrôleur sous forme de tableau.

Par exemple:

sortable_attributes :brand_model => ["brands.title", "models.title"]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top