Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import DataTables in npm?

The usual way of import "datatables.net-select"; doesn't seem to work.

I've looked on the website and it says to do:

var $       = require( 'jquery' );
var dt      = require( 'datatables.net' )( window, $ );

But I get a Cannot set property '$' of undefined

Am I missing something?

like image 801
A. L Avatar asked Jan 24 '17 04:01

A. L


1 Answers

Figured it out.

The only reason why I thought it wasn't working was because the css wasn't there. Make sure you also import the -dt stuff as well.

I.e:

import $ from 'jquery';

import 'datatables.net';
import 'datatables.net-dt/css/jquery.dataTables.css';
like image 169
A. L Avatar answered Oct 24 '22 17:10

A. L