Search code examples
ruby-on-railsruby-on-rails-3datatablestabletools

Datatables TableTools stopped working with can't find file error


I have been using datatables and tabletools for quite some time with great success.

However, over the past couple of days I have upgraded to Rails 3.2.18, and few smaller unrelated gems, nothing else has changed. Althoguh because of the way that the datable gem is referenced in the gemfile, this may have changed.

I now get the following error in firebug when I load a page which uses table tools

throw Error("Sprockets::FileNotFound: couldn't find file 'dataTables/extras/TableTools'\n  (in /home/michael/dev/appname/app/assets/javascripts/application.js:21)")

I have tried putting the gem in the assets area, as well as outside of it and it looks like the following

gem 'jquery-datatables-rails', git: 'git://github.com/rweng/jquery-datatables-rails.git'

My application.js file looks like the following

..
..
//= require twitter/bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap
//= require dataTables/extras/TableTools
..
..

So at this stage I am at a loss as to why my app has developed this bug. Does anyone have any thoughts on what I may be doing wrong, or what has changed?

Michael


Solution

  • You're not doing anything wrong, about a month ago (as of this writing) the owner changed the name of the libraries but did not update the install documents.

    Just change this line

    //= require dataTables/extras/TableTools

    to this

    //= require dataTables/extras/dataTables.tableTools

    If you're using any other stylesheet libraries, check the names here: https://github.com/rweng/jquery-datatables-rails/tree/master/app/assets/stylesheets/dataTables

    Also, you may have an issue with your JS libs after you make this change, check out the name of those new libs here: https://github.com/rweng/jquery-datatables-rails/tree/master/app/assets/javascripts/dataTables