I cannot seem to avoid the "object has no method 'dataTable' even though I have confirmed:
* jQuery is loaded before datatables
* jQuery is only loaded one time
The following is the HTML:
This snippet of coffeescript is causing the problem:
...when converted to this javascript:
The version of jQuery is 1.7.2 and the version of datatables is 1.9.2 all running on Rails 3.2.1 and included via the Rails datatables gem: https://github.com/rweng/jquery-datatables-rails
Any pointers / help would be much appreciated!
Thanks,
Daniel
* jQuery is loaded before datatables
* jQuery is only loaded one time
The following is the HTML:
<!DOCTYPE html> <html> <head> <title>Some App</title> <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/dataTables/jquery.dataTables.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/companies.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/fill_request.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/home.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/elephacies.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/elephacy_attributes.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/elephacy_configurations.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/refills.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/scaffolds.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/screen.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/store_hours.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/users.css?body=1" media="all" rel="stylesheet" type="text/css" /> <script src="/assets/jquery.js?body=1" type="text/javascript"></script> <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> <script src="/assets/dataTables/jquery.dataTables.js?body=1" type="text/javascript"></script> <script src="/assets/companies.js?body=1" type="text/javascript"></script> <script src="/assets/fill_request.js?body=1" type="text/javascript"></script> <script src="/assets/home.js?body=1" type="text/javascript"></script> <script src="/assets/elephacies.js?body=1" type="text/javascript"></script> <script src="/assets/elephacy_attributes.js?body=1" type="text/javascript"></script> <script src="/assets/elephacy_configurations.js?body=1" type="text/javascript"></script> <script src="/assets/store_hours.js?body=1" type="text/javascript"></script> <script src="/assets/usage.js?body=1" type="text/javascript"></script> <script src="/assets/application.js?body=1" type="text/javascript"></script> <meta content="authenticity_token" name="csrf-param" /> <meta content="Rhg7uIGoCS19AJSzBXpm+x3aVw304VBf1JF0WN/t0Xc=" name="csrf-token" /> <link href="/assets/core.css?body=1" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <a href="/users/sign_out" data-method="delete" rel="nofollow">Sign out</a> <div class="content"> <p class="notice"></p> <p class="alert"></p> <h1>Usage by name</h1> <table id="usage"> <thead> <tr> <th class="left_align">elephacy</th> <th class="left_align">Company</th> <th>Year</th> <th>Month</th> <th>Count</th> </tr> </thead> <tbody> <tr> <td>Some words</td> <td>kjkjhkjh</td> <td class="center_align">2012</td> <td class="center_align">10</td> <td class="center_align">3</td> </tr> <tr> <td>Random word</td> <td>blah</td> <td class="center_align">2012</td> <td class="center_align">10</td> <td class="center_align">3</td> </tr> </tbody> </table> <br /> </div> <div> <img class="right" src="/assets/logo.png" /> </div> </body> </html>
This snippet of coffeescript is causing the problem:
jQuery -> $('#usage').dataTable()
...when converted to this javascript:
(function() { jQuery(function() { return $('#usage').dataTable(); Uncaught TypeError: Object [object Object] has no method 'dataTable' }); }).call(this);
The version of jQuery is 1.7.2 and the version of datatables is 1.9.2 all running on Rails 3.2.1 and included via the Rails datatables gem: https://github.com/rweng/jquery-datatables-rails
Any pointers / help would be much appreciated!
Thanks,
Daniel