0.4.0 • Published 3 years ago

@buckneri/table v0.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

table

My take on building a more interactive HTML table. The build includes a starter CSS file, and two javascript versions for ES modules and current browsers. No serious attempt has been made towards ie11 compatibility.

Installation

npm i --save @buckneri/table

API

Constructor

const table = new Table({
  container: document.getElementById("table"),
  data: {
    headers: [{ value: "uuid", sort: false }, { value: "name", sort: true }],
    rows: [
      [{ value: 1 }, { value: "Robert" }], [{ value: 2 }, { value: "Jane" }]
    ]
  },
  locale: "en-GB",
  rows: 10
});

Events

"row-selected"
// emitted when table row is selected

Methods

table.data(data);
// stores and initialises data

table.destroy();
// self-destruct

table.draw();
// draws table to DOM

table.rowClickHandler();
// actions performed on row click

table.sortHandler();
// actions performed on column sort

table.toString();
// serialises the internal data

Properties

table.container
// parent element for table

table.locale
// locale code e.g. en-GB

table.rows
// number of rows to display
0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.3

4 years ago

0.2.4

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago