Repository is archived
No release in over 3 years
Low commit activity in last 3 years
DataTables assets for Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

>= 3.1
>= 3.1.1
 Project Readme

datatables-rails Gem Version

This Gem is unmaintained and deprecated. Please use Webpacker or a similar solution instead.

The datatables-rails gem packages the jQuery DataTables assets for easy inclusion in an Rails >= 3.1 application using the asset pipeline.

The MAJOR, MINOR and PATCH version numbers of this gem will follow the version numbers of jQuery DataTables. The fourth version number will be increased for changes unrelated to the assets themselves.

For an alternative solution, feel free to take a look at the jquery-datatables-rails gem.

Installation

To use this gem you need to include jQuery in your applications's javascript. To do so you may use the jquery-rails gem.

Add this line to your application's Gemfile:

gem 'datatables-rails', '~> 1.10.7.0'

And then execute:

$ bundle install

Usage

JavaScripts

Include the JavaScript in your app/assets/javascripts/application.js:

 //= require datatables/jquery_datatables

Make sure you add the line after the inclusion of jQuery ( //= require jquery).

Stylesheets

Include the stylesheet in your app/assets/stylesheets/application.css:

 *= require datatables/jquery_datatables

Initialization

Where needed in your JavaScripts, initialize your DataTables:

$(document).ready(function() {
  $("#mytable").dataTable();
});

Contributing

  1. Fork it
  2. Commit your changes (git commit -am 'My Changes')
  3. Push your changes (git push origin)
  4. Create a new Pull Request