Download
The best method for getting a hold of DataTables for use in your project depends upon your programming environment. The download builder below provides a simple method that you can use to build your own custom DataTables package - including only the software that you need, and providing options to have it hosted on the DataTables CDN, download the package locally or install through a package manager such as npm, yarn or bower.
Step 1. Choose a styling framework
Step 2. Select packages
Extensions
Step 3. Pick a download method
- CDN
- Download
- NPM
- Yarn
- Bower
- NuGet
- Composer
The DataTables CDN provides a convenient way to quickly get started with DataTables. The DataTables software is hosted on the CDN (powered by CloudFlare) and you simply need to include the HTML and CSS files as directed below.
The files required for the link
and script
tags shown above can be downloaded using the button below. The package is downloaded as a zip file which should be unzipped and uploaded to your web-server.
NPM is the package manager that ships with the popular Node.JS framework and is used extensively for both client-side and server-side packages.
Install
Use the following to install the selected software in your package:
The Editor NPM package is a holding and install package only. You will still need to download Editor. The NPM package contains a script that can be run to install the required files into node_modules
. See this post for more details.
Module require
To be able to use the selected software in your package, use the following code:
When used with CommonJS, the DataTables packages all export a factory function that can be executed with two optional arguments (shown without above):
- The window object to use (this is require as jQuery in a headless CommonJS environment can require a window with a document attached). If no parameter is given, or it is falsy,
window
will be used. - The jQuery object that DataTables should be attached to. If no parameter is given, the package will do its own
require('jquery')
to include jQuery.
For example if you wish to use your own `window` and `jQuery` parameters:
var $ = require( 'jquery' );
var dt = require( 'datatables.net' )( window, $ );
Please note that the above is shown for CommonJS modules. If you are using an AMD loader, you do not need to execute the require
d library (i.e. remove the trailing ()
).
Yarn is a package manager that makes use of the NPM registry, and so has access to all of the same packages.
Install
Use the following to install the selected software in your package:
The Editor NPM package is a holding and install package only. You will still need to download Editor. The NPM package contains a script that can be run to install the required files into node_modules
. See this post for more details.
Module require
To be able to use the selected software in your package, use the following code:
When used with CommonJS, the DataTables packages all export a factory function that can be executed with two optional arguments (shown without above):
- The window object to use (this is require as jQuery in a headless CommonJS environment can require a window with a document attached). If no parameter is given, or it is falsy,
window
will be used. - The jQuery object that DataTables should be attached to. If no parameter is given, the package will do its own
require('jquery')
to include jQuery.
For example if you wish to use your own `window` and `jQuery` parameters:
var $ = require( 'jquery' );
var dt = require( 'datatables.net' )( window, $ );
Please note that the above is shown for CommonJS modules. If you are using an AMD loader, you do not need to execute the require
d library (i.e. remove the trailing ()
).
Bower is a popular client-side package manager, and while it has now largely been supplanted by npm / yarn, there are still a number of older projects that use it.
Install
Nuget is the package manager for .NET applications, the datatables packages are hosted here so that they can be easily integrated into .NET projects.