gryphon / simple_datatables

Simple Datatables.net integration for rails 3
MIT License
60 stars 40 forks source link

Custom pagination advice doesn't work #18

Closed gbirchmeier closed 12 years ago

gbirchmeier commented 12 years ago

From the readme "Custom pagination implementations" section:

Also if you are using own or uncommon implementation of pagination you may use direct page count variables setting as follows:

respond_with @products, :locals => {:total_entries => 12, :current_page_entries => 10}

This does not appear to work. In application.datatables.jsonify, the variables total_entries and current_page_entries remain unset.

gbirchmeier commented 12 years ago

Looks like the :locals thing flat-out doesn't work.

I got around this by assigning class variables, e.g.

In controller:

@total_entries = x
@current_page_entries = y
respond_with @products

In application.datatables.jsonify, you can see the @total_entries and @current_page_entries variables.

Kind of a kludge, but it works.

gryphon commented 12 years ago

It seems locals do not work anymore in this case. I moved params to globals as from your example and will release it in the next version.