This repository has been archived by the owner on May 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Getting Started
Karl edited this page Jun 17, 2017
·
3 revisions
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/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>
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,
...
});
- datatable.init
- datatable.refresh
- datatable.update
- datatable.page
- datatable.sort
- datatable.perpage
- datatable.search
- perPage
- perPageSelect
- nextPrev
- prevText
- nextText
- firstLast
- firstText
- lastText
- searchable
- sortable
- truncatePager
- fixedColumns
- fixedHeight
- columns
- data
- ajax
- labels
- layout
- header
- footer
- table
- head DEPRECATED
- body DEPRECATED
- foot DEPRECATED
- wrapper
- container
- pagers
- headings
- options DEPRECATED
- initialized
- isIE DEPRECATED
- data
- activeRows DEPRECATED
- dataIndex
- pages
- hasRows
- hasHeadings
- currentPage
- totalPages
- onFirstPage
- onLastPage
- searching
- searchData