Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

372
Views
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?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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';
over 4 years ago · Santiago Trujillo Report

0

I'm using DataTables 1.10.19 with Symfony 4.1.7 + Webpack Encore 0.21

    import $ from 'jquery';
    import dt from 'datatables.net-bs';
    global.$.DataTable = dt;
over 4 years ago · Santiago Trujillo Report

0

This worked for me:

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

like described here https://github.com/DataTables/DataTables/issues/434

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!