Datatables and require js conflict?
Datatables and require js conflict?
BDHarrington7
Posts: 2Questions: 0Answers: 0
Hi, I've used Datatables before in a simpler asp.net application, where I could just import the library with a script tag, but I'm working on a different platform now that uses requirejs. It seems like these two plugins aren't playing nice, because I can get both jQuery and datatables.js loaded, but when I call .dataTable() on the jQuery object, the reference to that function can't be found.
Here's a jsfiddle: http://jsfiddle.net/zMqZ3/1/
in my environment, I've paused right inside the callback function for the require call, and verified that datatables was loaded at that point, but the error was still thrown. I haven't been able to find any answers to this on stack overflow or on these forums; there was one guy who seemed to have the same issue, but he didn't give an example and there was no follow-up.
Here's a jsfiddle: http://jsfiddle.net/zMqZ3/1/
in my environment, I've paused right inside the callback function for the require call, and verified that datatables was loaded at that point, but the error was still thrown. I haven't been able to find any answers to this on stack overflow or on these forums; there was one guy who seemed to have the same issue, but he didn't give an example and there was no follow-up.
This discussion has been closed.
Replies
Allan
[code]
requirejs.config({
paths: {
'datatables': '//cdn.datatables.net/1.10-dev/js/jquery.dataTables'
}
});
require(['datatables'], function () {
...
} );
[/code]
http://jsfiddle.net/zMqZ3/8/
Allan