Advanced data table library with complete WordPress plugin parity - zero dependencies, mobile-first, API-ready.
WordPress Plugin Replacement: Drop-in replacement for WordPress Gravity Tables with 100% feature parity plus modern enhancements.
π Complete Documentation | π― Live Examples | π API Reference
- π Advanced Filtering - Auto-detection, multiselect, date ranges, number ranges
- β‘ Bulk Operations - Multi-row selection, progress indicators, custom actions
- π Lookup Fields - API-driven dropdowns with caching and role-based filtering
- π‘οΈ Permission System - Role-based access control with user context
- π± Enhanced Mobile Cards - Expandable sections with field visibility controls
- πΎ State Persistence - Remember filters, sorting, pagination across sessions
- π API Integration - RESTful CRUD operations with authentication
- βοΈ Advanced Editing - Inline editing with lookup dropdowns and validation
- π Zero Dependencies - Pure vanilla JavaScript (45KB bundle)
- π± Mobile First - Touch-optimized with expandable card layouts
- π Framework Agnostic - React, Vue, Angular, WordPress, or vanilla HTML
- π§ Enterprise Ready - Permissions, bulk operations, API integration
- π¨ Highly Customizable - CSS variables, themes, component styling
- π Performance Optimized - Virtual scrolling, efficient rendering
npm install tablecrafter<script src="https://unpkg.com/tablecrafter@latest/dist/tablecrafter.min.js"></script><div id="my-table"></div>
<script>
const data = [
{ id: 1, name: 'John Doe', email: 'john@example.com', department: 'Engineering' },
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', department: 'Design' },
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', department: 'Management' }
];
const table = new TableCrafter('#my-table', {
data: data,
columns: [
{ field: 'id', label: 'ID' },
{ field: 'name', label: 'Name', editable: true },
{ field: 'email', label: 'Email', editable: true },
{ field: 'department', label: 'Department', editable: true }
],
editable: true,
responsive: true,
pagination: true
});
table.render();
</script>const advancedTable = new TableCrafter('#advanced-table', {
data: '/api/employees',
// Advanced filtering with auto-detection
filters: {
advanced: true,
autoDetect: true,
showClearAll: true
},
// Bulk operations
bulk: {
enabled: true,
operations: ['delete', 'export', 'promote']
},
// API integration
api: {
baseUrl: '/api/employees',
authentication: { type: 'bearer', token: 'jwt-token' }
},
// Permission system
permissions: {
enabled: true,
edit: ['admin', 'manager'],
delete: ['admin']
},
// State persistence
state: { persist: true }
});
// Set user context for permissions
table.setCurrentUser({ id: 1, roles: ['admin'] });
table.render();π View Complete Documentation
const config = {
data: [], // Array of objects or URL string
columns: [], // Column definitions (required)
editable: false, // Enable inline editing
responsive: true, // Enable mobile card view
mobileBreakpoint: 768, // Pixel width for mobile view
pagination: false, // Enable pagination
pageSize: 25, // Rows per page
sortable: true, // Enable column sorting
filterable: true, // Enable filtering
exportable: false, // Enable CSV export
exportFilename: 'export.csv', // Default export filename
onEdit: function(change) { // Callback for edits
console.log('Cell edited:', change);
},
onSort: function(column, direction) { // Callback for sorting
console.log('Sorted by:', column, direction);
}
};const columns = [
{
field: 'id', // Data field name (required)
label: 'ID', // Display label (required)
editable: false, // Can this column be edited?
sortable: true, // Can this column be sorted?
filterable: true // Can this column be filtered?
},
{
field: 'name',
label: 'Full Name',
editable: true,
sortable: true
}
];table.render()- Render/re-render the tabletable.getData()- Get current filtered datatable.setData(data)- Replace table datatable.addRow(rowData)- Add a new rowtable.removeRow(index)- Remove row by indextable.updateRow(index, rowData)- Update specific row
table.setFilter(column, value)- Set filter for specific columntable.clearFilters()- Clear all filterstable.sort(column, direction)- Sort by column ('asc' or 'desc')
table.exportCSV()- Export current data to CSVtable.exportCSV(filename)- Export with custom filename
table.destroy()- Clean up and remove event listenerstable.refresh()- Refresh table display
TableCrafter triggers custom events that you can listen to:
const table = new TableCrafter('#my-table', config);
// Listen for cell edits
table.on('cellEdit', function(event) {
console.log('Cell edited:', event.detail);
});
// Listen for row selection
table.on('rowSelect', function(event) {
console.log('Row selected:', event.detail);
});
// Listen for sort changes
table.on('sort', function(event) {
console.log('Table sorted:', event.detail);
});TableCrafter uses CSS classes with the tc- prefix. You can customize the appearance by overriding these classes:
/* Main table wrapper */
.tc-wrapper { }
/* Table styles */
.tc-table { }
.tc-table th { }
.tc-table td { }
/* Mobile card view */
.tc-cards-container { }
.tc-card { }
/* Filters */
.tc-filters { }
.tc-filter { }
/* Pagination */
.tc-pagination { }
/* Edit mode */
.tc-editable { }
.tc-edit-input { }- Modern Browsers: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
- Mobile: iOS Safari 12+, Chrome Mobile 60+
- Legacy: IE11+ (with polyfills for fetch API and CSS Grid)
const table = new TableCrafter('#table', {
data: '/api/users', // URL endpoint
columns: [
{ field: 'name', label: 'Name' },
{ field: 'email', label: 'Email' }
]
});const table = new TableCrafter('#table', {
data: users,
columns: columns,
onEdit: function(change) {
if (change.field === 'email' && !change.newValue.includes('@')) {
alert('Invalid email address');
return false; // Reject the change
}
return true; // Accept the change
}
});# Install dependencies
npm install
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Build for production
npm run build- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Add tests for new features
- Ensure all tests pass (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Migrating from WordPress Gravity Tables? TableCrafter provides 100% feature parity:
| WordPress Feature | TableCrafter.js | Status |
|---|---|---|
| Advanced Filtering | β Auto-detection | Enhanced |
| Bulk Operations | β Progress indicators | Enhanced |
| Mobile Cards | β Expandable sections | Enhanced |
| Lookup Fields | β API integration | Enhanced |
| Permissions | β Role-based access | Enhanced |
| Inline Editing | β Dropdown lookups | Enhanced |
π Migration Guide
- π’ WordPress Plugin Replacement - Replace Gravity Tables installations
- π Enterprise Dashboards - Role-based data access with permissions
- π SaaS Admin Interfaces - Multi-tenant user management
- π± Mobile-First Applications - Touch-optimized data tables
- π API-Driven Applications - Dynamic lookup fields, real-time updates
- React - React component wrapper
- Vue.js - Vue component integration
- Angular - Angular component setup
- WordPress - WordPress plugin integration
- π Documentation - Complete guides and API reference
- π― Examples - Live demos and code samples
- π Issues - Bug reports and feature requests
- π¬ Discussions - Community support
MIT License - see LICENSE file for details.
TableCrafter.js - Advanced data table library with complete WordPress plugin parity, zero dependencies, and mobile-first design.