Getting Started - Mobius1/Vanilla-DataTables GitHub Wiki

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,
    ...
});
⚠️ **GitHub.com Fallback** ⚠️