A lightweight, dependency-free javascript HTML table plugin. Similar to jQuery DataTables, but without the dependencies.
Demos | Documentation | Changelog
bower install vanilla-datatables --save
npm install vanilla-datatables --save
Add the css and js files from the CDN:
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/vanilla-datatables/1.1.6/vanilla-dataTables.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/vanilla-datatables/1.1.6/vanilla-dataTables.min.js"></script>
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,
...
});
Copyright © 2017 Karl Saunders | MIT license