Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Getting Started

Karl edited this page Jun 17, 2017 · 3 revisions

Install

Bower

bower install vanilla-datatables --save

npm

npm install vanilla-datatables --save

Browser

Add the css and js files from the CDN:

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/mobius1/vanilla-Datatables@latest/vanilla-dataTables.min.css">

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/mobius1/vanilla-Datatables@latest/vanilla-dataTables.min.js"></script>

Initialise

The JS file should be included before any scripts that call the plugin.

Then just initialise the plugin by either passing a reference to the table or a CSS3 selector string as the first parameter:

var myTable = document.querySelector("#myTable");
var dataTable = new DataTable(myTable);

// or

var dataTable = new DataTable("#myTable");

You can also pass the options object as the second paramater:

var dataTable = new DataTable("#myTable", {
    searchable: false,
    fixedHeight: true,
    ...
});
Clone this wiki locally