Datatables is a nifty jquery plugin that adds the ability to paginate, sort, and search your html tables. When dealing with large tables (more than a couple hundred rows) however, we run into performance issues. These can be fixed by using server-side pagination, but this breaks some datatables functionality.
ajax-datatables-rails
is a wrapper around datatable's ajax methods that allow synchronization with server-side pagination in a rails app.
Add these lines to your application's Gemfile:
gem 'jquery-datatables-rails'
gem 'ajax-datatables-rails'
And then execute:
$ bundle
Run the following command:
rails generate ajaxdatatable <modelname>
This will generate a file in app/datatables
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request