How to add add sorting to html table fields


#1

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.


#2

You can use datatables in the view…


#3

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


#4

On 15 July 2016 at 15:10, Lekha P. removed_email_address@domain.invalid 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