How to add add sorting to html table fields

Hi Please help to find how to add sorting to all fields in html table ,
backend is mongodb with mongoid and also iam using kaminari gem for
pagination.

You can use datatables in the view…

Hey Lekha,

In your controller#index, before you call the .page method, add the
ordering.

e.g. Data.order(:created_at).page(params[:page)

all the best

Ben

On 15 July 2016 at 15:10, Lekha P. [email protected] wrote:

Hi Please help to find how to add sorting to all fields in html table ,
backend is mongoid and also iam using kaminari gem for pagination.

Just sort the data before you pass it to the view for inclusion in the
table.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs