Skip to content

Commit d01d134

Browse files
committed
feat: Enhance getting-started guide with advanced configuration
- Add WordPress parity feature showcase with comprehensive example - Include advanced filtering, bulk operations, lookup fields configuration - Add API integration setup with authentication - Demonstrate permission system and state persistence - Add WordPress-specific integration example - Show enterprise-grade features in getting-started context
1 parent 8034bce commit d01d134

File tree

1 file changed

+193
-2
lines changed

1 file changed

+193
-2
lines changed

docs/guide/getting-started.md

Lines changed: 193 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Getting Started
22

3-
This guide will help you get up and running with TableCrafter.js in just a few minutes.
3+
This guide will help you get up and running with TableCrafter.js and its advanced WordPress plugin parity features in just a few minutes.
44

55
## Installation
66

@@ -15,13 +15,23 @@ npm install tablecrafter
1515
### CDN
1616

1717
```html
18+
<!-- Include both CSS and JavaScript -->
19+
<link rel="stylesheet" href="https://unpkg.com/tablecrafter@latest/dist/tablecrafter.min.css">
1820
<script src="https://unpkg.com/tablecrafter@latest/dist/tablecrafter.min.js"></script>
1921
```
2022

2123
### Download
2224

2325
You can also download the latest release from [GitHub](https://github.com/TableCrafter/tablecrafter/releases) and include it directly in your project.
2426

27+
## Quick Start Options
28+
29+
TableCrafter offers different complexity levels depending on your needs:
30+
31+
- **[Basic Usage](#basic-usage)** - Simple tables with sorting and filtering
32+
- **[Advanced Configuration](#advanced-configuration)** - WordPress parity features with API integration
33+
- **[WordPress Integration](#wordpress-integration)** - Drop-in replacement for WordPress plugins
34+
2535
## Basic Usage
2636

2737
### HTML Structure
@@ -98,6 +108,7 @@ Let's create a complete example with some sample data:
98108
<meta charset="UTF-8">
99109
<meta name="viewport" content="width=device-width, initial-scale=1.0">
100110
<title>My First TableCrafter Table</title>
111+
<link rel="stylesheet" href="https://unpkg.com/tablecrafter@latest/dist/tablecrafter.min.css">
101112
</head>
102113
<body>
103114
<div id="users-table"></div>
@@ -125,7 +136,8 @@ Let's create a complete example with some sample data:
125136
editable: true,
126137
responsive: true,
127138
pagination: true,
128-
pageSize: 10
139+
pageSize: 10,
140+
exportable: true
129141
});
130142
131143
table.render();
@@ -143,6 +155,185 @@ This example demonstrates several key features:
143155
- **Inline editing** by clicking cells
144156
- **Responsive design** that adapts to mobile
145157
- **Pagination** for large datasets
158+
- **CSV export** functionality
159+
160+
## Advanced Configuration
161+
162+
For WordPress plugin parity and enterprise features, TableCrafter offers advanced configuration options:
163+
164+
### WordPress-Level Features
165+
166+
```javascript
167+
const table = new TableCrafter('#advanced-table', {
168+
// API data source
169+
data: '/api/employees',
170+
171+
columns: [
172+
{ field: 'id', label: 'ID' },
173+
{ field: 'name', label: 'Name', editable: true },
174+
{ field: 'email', label: 'Email', editable: true },
175+
{
176+
field: 'department_id',
177+
label: 'Department',
178+
editable: true,
179+
lookup: {
180+
url: '/api/departments',
181+
valueField: 'id',
182+
displayField: 'name',
183+
filter: { active: true }
184+
}
185+
},
186+
{
187+
field: 'manager_id',
188+
label: 'Manager',
189+
lookup: {
190+
url: '/api/users',
191+
valueField: 'id',
192+
displayField: 'name',
193+
filter: { role: 'manager' }
194+
}
195+
}
196+
],
197+
198+
// Advanced filtering with auto-detection
199+
filters: {
200+
advanced: true,
201+
autoDetect: true,
202+
showClearAll: true,
203+
types: {
204+
'department_id': { type: 'multiselect' },
205+
'hire_date': { type: 'daterange' },
206+
'salary': { type: 'numberrange' }
207+
}
208+
},
209+
210+
// Bulk operations
211+
bulk: {
212+
enabled: true,
213+
operations: ['delete', 'export', 'promote'],
214+
showProgress: true
215+
},
216+
217+
// Enhanced responsive design
218+
responsive: {
219+
enabled: true,
220+
fieldVisibility: {
221+
mobile: {
222+
showFields: ['name', 'department_id'],
223+
hideFields: ['id', 'email', 'manager_id']
224+
},
225+
tablet: {
226+
showFields: ['name', 'email', 'department_id']
227+
}
228+
}
229+
},
230+
231+
// Add new entries
232+
addNew: {
233+
enabled: true,
234+
modal: true,
235+
fields: [
236+
{ name: 'name', label: 'Full Name', type: 'text', required: true },
237+
{ name: 'email', label: 'Email', type: 'email', required: true },
238+
{ name: 'department_id', label: 'Department', type: 'select', required: true }
239+
],
240+
validation: {
241+
name: { required: true, minLength: 2 },
242+
email: { required: true, type: 'email' }
243+
}
244+
},
245+
246+
// API integration
247+
api: {
248+
baseUrl: '/api/employees',
249+
endpoints: {
250+
data: '',
251+
create: '',
252+
update: '/{id}',
253+
delete: '/{id}',
254+
lookup: '/lookup'
255+
},
256+
headers: {
257+
'Authorization': 'Bearer your-jwt-token',
258+
'X-API-Key': 'your-api-key'
259+
},
260+
authentication: {
261+
type: 'bearer',
262+
token: 'your-jwt-token'
263+
}
264+
},
265+
266+
// Permission system
267+
permissions: {
268+
enabled: true,
269+
view: ['admin', 'manager', 'employee'],
270+
edit: ['admin', 'manager'],
271+
delete: ['admin'],
272+
create: ['admin', 'manager'],
273+
ownOnly: false
274+
},
275+
276+
// State persistence
277+
state: {
278+
persist: true,
279+
storage: 'localStorage',
280+
key: 'employee_table_state'
281+
},
282+
283+
// Event callbacks
284+
onEdit: function(event) {
285+
console.log('Data edited:', event);
286+
},
287+
onBulkAction: function(event) {
288+
console.log('Bulk action performed:', event);
289+
},
290+
onFilter: function(event) {
291+
console.log('Filters applied:', event);
292+
},
293+
onAdd: function(event) {
294+
console.log('New entry added:', event);
295+
}
296+
});
297+
298+
// Set user context for permissions
299+
table.setCurrentUser({
300+
id: 1,
301+
name: 'John Admin',
302+
roles: ['admin', 'manager']
303+
});
304+
305+
table.render();
306+
```
307+
308+
### Advanced Features Demonstrated
309+
310+
This configuration showcases:
311+
312+
- **🔗 Lookup Fields** - Dynamic dropdowns with API data sources
313+
- **🔍 Auto-Filtering** - Intelligent filter type detection
314+
- **⚡ Bulk Operations** - Multi-row selection with custom actions
315+
- **📱 Mobile Optimization** - Field visibility per device type
316+
- **🛡️ Permissions** - Role-based access control
317+
- **💾 State Persistence** - User preference memory
318+
- **🔄 API Integration** - Full CRUD operations with authentication
319+
- **➕ Add New Entries** - Modal-based data creation with validation
320+
321+
## WordPress Integration
322+
323+
For WordPress sites, TableCrafter can replace existing Gravity Tables installations:
324+
325+
```javascript
326+
// WordPress-specific integration
327+
const wpTable = new WordPressTableCrafter('#wp-table', tableId, {
328+
gravityFormsIntegration: true,
329+
userRoleFilter: 'driver',
330+
ownOnly: true,
331+
wpApiBase: '/wp-json/tablecrafter/v1',
332+
nonce: window.tablecrafterNonce
333+
});
334+
335+
wpTable.render();
336+
```
146337

147338
## Next Steps
148339

0 commit comments

Comments
 (0)