Registry / web-framework / datatables.net

datatables.net

JSON →
library2.3.8jsnpmunverified

DataTables is a powerful JavaScript library for enhancing HTML tables with advanced interaction controls such as pagination, instant search, multi-column sorting, and server-side processing. The current stable version is 2.3.8, released on a regular schedule with minor updates and patches. It requires jQuery as a dependency and provides a rich API for customizing table behavior. DataTables differentiates itself with extensive community support, numerous plugins, and seamless integration with jQuery. A major 3.0 beta is in development, which will introduce breaking changes and new features.

npm install datatables.net
INSTALL
IMPORT
SIG · DATATABLES.NET
D
datatables.net
web-frameworkjavascriptv2.3.8
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DataTable
✓ import DataTable from 'datatables.net'
✗ const DataTable = require('datatables.net')
Default export provides the DataTable constructor. In CJS environments, use require('datatables.net') with CommonJS, but TypeScript types are designed for ESM default import.
$
✓ import $ from 'jquery'; import DataTable from 'datatables.net'
✗ import DataTable from 'datatables.net'; (missing jQuery import)
DataTables requires jQuery globally. Import jQuery separately and ensure it's loaded before DataTables.
type Config
✓ import type { Config } from 'datatables.net'
✗ import { Config } from 'datatables.net' (runtime import)
Config is a TypeScript type/interface. Use type-only import to avoid runtime errors.

Creates a new DataTable instance from an HTML table element with data, enabling pagination, search, and sorting.

import $ from 'jquery'; import DataTable from 'datatables.net'; const table = new DataTable('#myTable', { paging: true, searching: true, ordering: true, pageLength: 10, serverSide: false, columns: [ { data: 'name' }, { data: 'position' }, { data: 'office' }, { data: 'age' }, { data: 'salary' } ], data: [ { name: 'Tiger Nixon', position: 'System Architect', office: 'Edinburgh', age: 61, salary: '$320,800' }, { name: 'Garrett Winters', position: 'Accountant', office: 'Tokyo', age: 63, salary: '$170,750' } ] }); console.log(table.rows().count());
Debug
Known issues
breakingDataTables v2 drops the $.fn.dataTable jQuery API. Use the importable DataTable constructor instead.
fix
Replace $(...).DataTable() with new DataTable(...) and import DataTable from 'datatables.net'.
affects: >=2.0.0
deprecatedUsing $('#table').DataTable() is deprecated in v2 and removed in v3 beta.
fix
Use new DataTable('#table') from the module instead.
affects: >=2.0.0 <3.0.0
gotchaDataTables requires jQuery to be loaded before importing DataTable. Failing to do so results in a runtime error: 'jQuery is not defined'.
fix
Ensure jQuery is installed and imported: import $ from 'jquery'; then import DataTable.
affects: >=1.0.0
gotchaWhen using DataTables with webpack or similar bundlers, the default import might be undefined if jQuery is not properly provided.
fix
Use webpack.ProvidePlugin to expose jQuery globally or use imports-loader.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: (intermediate value).DataTable is not a function
Trying to call $(...).DataTable() without proper import or before jQuery is loaded.
fix
Use the module import: import DataTable from 'datatables.net'; new DataTable('#table');
Error: Cannot find module 'jquery'
jQuery is not installed as a dependency.
fix
Run npm install jquery and import it before DataTables.
TS2322: Type 'undefined' is not assignable to type 'Config'
Trying to use import { Config } from 'datatables.net' at runtime instead of using type-only import.
fix
Use import type { Config } from 'datatables.net' for TypeScript.
Upgrade
Version history
2.3.8latest on npm
Audit
Dependencies
jqueryrequiredDataTables depends on jQuery for DOM manipulation and event handling.
Agent activity
7 hits · last 30 days
node
4
Resources
datatables.net — npm install datatables.net · libregistry