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

368
Views
¿Cómo importar DataTables en npm?

La forma habitual de import "datatables.net-select"; no parece funcionar

He mirado en la web y dice que hacer:

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

Pero obtengo un Cannot set property '$' of undefined

¿Me estoy perdiendo de algo?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Lo averigué.

La única razón por la que pensé que no funcionaba fue porque el css no estaba allí. Asegúrate de importar también el material -dt .

Es decir:

 import $ from 'jquery'; import 'datatables.net'; import 'datatables.net-dt/css/jquery.dataTables.css';
over 4 years ago · Santiago Trujillo Report

0

Estoy usando DataTables 1.10.19 con 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

Esto funcionó para mí:

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

como se describe aquí 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!