Installing
Editor can be installed in a number of different ways, and which is best for you will depend upon your project and the tooling that you use. Editor can be installed:
- As a standard
scriptfile included on your page, with the file hosted on our CDN, or on your own local server, or - Via an NPM package manager (e.g.
npm,yarn,pnpmand others)
As with all of the extensions for DataTables, start with the download builder and select the packages that you want (including Editor!), and then select the installation method that you want to use. It will then show you the installation steps for your selected options.
The download builder is strongly recommended, however, if you prefer to create the installation yourself, below there is an overview of installation via the CDN and npm for the DataTables default styling of Editor.
Demo apps
In addition to the client-side scripts for Editor, due to isn't nature of primarily integrating with a backend and a database, we publish demo applications for the supported server-side platforms. You can find the download packages on the Editor download page, and the platform specific instructions are available:
Generator
In addition to the demo apps, you can create your own customised downloadable app for Editor using the Generator quick start tool. This is a page that will let you enter basic information about a database table and it will then create the client and server-side software needed to display it in an editable database, which you can then download and run.
CDN
To install Editor from the DataTables CDN as individual files, assuming that you already have DataTables installed simply add the CSS and JS for Editor by inserting the following two tags to your HTML, after the core DataTables file has been included.
<link href="https://cdn.datatables.net/editor/3.0.0-beta.1/css/editor.dataTables.min.css" rel="stylesheet">
<script src="https://cdn.datatables.net/editor/3.0.0-beta.1/js/dataTables.editor.min.js"></script>
Once done you will be able to define the editor option in the DataTable options to configure Editor. Please see the configuration documentation for details.
NPM
For installation of Editor via npm use:
npm install datatables.net-editor-dt
Note that the -dt at the end of the package name denotes that it is for DataTables default styling. For other styling integrations, this postfix must be changed. Use the download builder to get the required packages.
To use Editor in your own software include the following just after you import the core DataTables library - e.g.:
import DataTable from 'datatables.net-dt';
import 'datatables.net-editor-dt';
Note that Editor doesn't import to a specific constant - rather the software is automatically attached to the constant imported from DataTables core and made available from there.
You will now be able to define the editor option in the DataTable options to configure Editor. Please see the configuration documentation for details.
Legacy NPM repository
Prior to the release of Editor 3, the software was not available on either the DataTables CDN or the central NPM repository. As such, a private npm repository was available. This is still available and you can continue to use it if it is part of your existing toolchain, however, it is recommended that if you can, then you should update to the new central NPM packages noted above.
Instructions for use of the legacy private NPM repository are shown below.
Configure access
Our private npm repository uses an authentication token to allow installation of Editor. Login with your account that has a license, or start a trial on our download page to get your secret token.
To use this token in your project, create a .npmrc file in the root directory of your project (where your package.json file is) and add the following:
@datatables.net:registry=https://npm.datatables.net/
//npm.datatables.net/:_authToken=your-auth-token
If you are using Yarn v2+, you'll need a yarnrc.yml file instead (note that Yarn v1 will work with the .npmrc method described above):
npmScopes:
datatables.net:
npmAlwaysAuth: true
npmRegistryServer: "https://npm.datatables.net/"
npmAuthToken: "your-auth-token"
The next step is to install the Editor package with the package manager of your choice. As with DataTables core and its other extensions, Editor offers full integration with multiple styling libraries - the example code below shows the installation of the default DataTables styling - change the -dt postfix to suit the styling you need (please use the download builder for other styles).
Install with npm:
npm install --save @datatables.net/editor-dt
Note that this will install the styling package for Editor. The Editor core library is a separate package, which is a dependency of the package shown above and will automatically be installed.