Object has no method 'dataTable'

Object has no method 'dataTable'

plaxdanplaxdan Posts: 1Questions: 0Answers: 0
edited November 2012 in General
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:

[code]
<!DOCTYPE html>


Some App































Sign out





Usage by name




elephacy
Company
Year
Month
Count




Some words
kjkjhkjh
2012
10
3


Random word
blah
2012
10
3















[/code]

This snippet of coffeescript is causing the problem:

[code]

jQuery ->
$('#usage').dataTable()

[/code]

...when converted to this javascript:

[code]

(function() {

jQuery(function() {
return $('#usage').dataTable();
Uncaught TypeError: Object [object Object] has no method 'dataTable'
});

}).call(this);

[/code]

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

Replies

  • plaxdanplaxdan Posts: 1Questions: 0Answers: 0
    DISREGARD

    Turns out that precompiled assets were resulting in two versions of jQuery after all. One called jQuery.js and another bundled into the application.js
This discussion has been closed.