How to include datatables responsive in ES6
How to include datatables responsive in ES6
Hi
I'm looking for the alternative in ES6 import to "https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"
For example I have "import Datatables from 'datatables/media/js/jquery.dataTables';" which I use for the basic datatable init.
I have tried with "import Responsive from 'datatables.net-responsive/js';" but it does not work
Prior to all this I have run: npm install --save datatables.net-responsive-dt
So my question is: How do I invoke my datatatables.responsive node_module in my ES6 js file :-)
This question has an accepted answers - jump to answer
Answers
That should work I'd thought. Could you
console.log( Responsive );
there and let me know what it is? It should be the DataTables object.Allan
Ok, My bad. I did not include the file name....
It should be:
import Responsive from 'datatables.net-responsive/js/dataTables.responsive';
and not justimport Responsive from 'datatables.net-responsive/js
But your answer led me on my way
You should actually just be able to use:
The
package.json
file for that package usesmain
to point to the Responsive Javascript file.Allan