simple-datatables

Install

npm install simple-datatables --save

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:

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

// or

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

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

let dataTable = new DataTable("#myTable", {
    searchable: false,
    fixedHeight: true,
    ...
});

Initial data

You can either supply initial data through the options object or by starting with a table that already has data filled in.

If you start out with a table that already contains header cells, you can add these attributes to individual header cells to influence how the corresponding column is treated:

If you start out with a table that already contains data, you can add these attributes to individual cells to influence how the cell is being processed: