HTMLTableKit is a pure JavaScript library designed to transform HTML tables into live objects, enabling dynamic interactions without the need for bulky frameworks. Features include automatic parsing, type detection, CRUD operations, and seamless DOM synchronization, all while maintaining lightweight performance.
HTMLTableKit is a lightweight JavaScript library designed to manipulate HTML tables as dynamic entities, enabling seamless interactions without the burden of complex frameworks or excessive dependencies. This library caters to developers needing a straightforward solution to manage table data in pure JavaScript while avoiding the challenges associated with Single Page Applications (SPAs).
HTMLTableKit intelligently recognizes the following data types for table columns:
The library's dist/ directory features multiple builds:
HTMLTableKit.d.ts for full TypeScript compatibility and IntelliSense.For integrating HTMLTableKit into projects:
import HTMLTableKit from 'htmltablekit';
import HTMLTableKit from './dist/HTMLTableKit.js';
// or for production
import HTMLTableKit from './dist/HTMLTableKit.min.js';
<script src="dist/HTMLTableKit.standalone.js"></script>
To access and log the structure of the table:
const tableData = tableKit.getTable();
console.log(tableData);
Here are examples of synchronous CRUD operations:
const newRow = tableKit.addRow({
name: "John Doe",
age: 30,
salary: 50000.50,
active: true
});
const success = tableKit.updateRow("row_1", {
salary: 55000.00
});
const success = tableKit.deleteRow("row_1");
The library also supports asynchronous CRUD operations, ideal for modern API integrations:
const newRow = await tableKit.addRowAsync(
{ name: "John", age: 30, salary: 50000 },
async (row) => {
const response = await fetch('/api/employees', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(row)
});
if (!response.ok) {
return null;
}
return await response.json();
}
);
This library encapsulates robust features for transforming HTML table management, significantly improving efficiency in web applications where traditional methods may fall short.
No comments yet.
Sign in to be the first to comment.