Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ginkelsoft DataTables
# Ginkelsoft DataTables version 0.0.9

Ginkelsoft DataTables is a flexible and easy-to-use package for managing tabular data in Laravel projects. This package **requires Livewire** for dynamic, AJAX-driven experiences. You can easily add filtering, searching, sorting, and bulk actions with minimal setup.

Expand All @@ -10,10 +10,11 @@ Ginkelsoft DataTables is a flexible and easy-to-use package for managing tabular
2. [Installation](#installation)
3. [Usage With Livewire](#usage-with-livewire)
4. [Filters](#filters)
5. [Actions & Bulk Actions](#actions--bulk-actions)
6. [Additional Features](#additional-features)
7. [Contributing](#contributing)
8. [License](#license)
5. [Sorting](#sorting)
6. [Actions & Bulk Actions](#actions--bulk-actions)
7. [Additional Features](#additional-features)
8. [Contributing](#contributing)
9. [License](#license)

---

Expand Down Expand Up @@ -48,30 +49,33 @@ This package **requires Livewire** and cannot be used without it. To integrate D
```blade
<livewire:datatable
model="App\\Models\\User"
:columns="['id', 'name', 'email']"
:columns="['id', 'name', 'email', 'created_at']"
:hidden-columns="['id']"
:filters="[
['column' => 'name', 'type' => 'input', 'label' => 'Naam'],
['column' => 'email', 'type' => 'input', 'label' => 'Email'],
['column' => 'created_at', 'type' => 'date', 'label' => 'Aangemaakt op'],
['column' => 'email_verified_at', 'type' => 'checkbox', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
['column' => 'email_verified_at', 'type' => 'select', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
]"
:actions="[
['label' => 'Edit', 'route' => 'users.edit'],
['label' => 'Delete', 'route' => 'users.destroy']
['name' => 'edit', 'label' => 'Edit', 'route' => 'users.datatable.export'],
['name' => 'delete', 'label' => 'Delete', 'route' => 'users.datatable.export'],
['name' => 'view', 'label' => 'View Profile', 'url' => '/users/{id}']
]"
:bulkActions="[
'delete' => ['label' => 'Delete', 'route' => 'users.bulk.delete'],
'export' => ['label' => 'Export', 'route' => 'users.bulk.export']
]"
:filters="[
['column' => 'name', 'type' => 'text'],
['column' => 'role', 'type' => 'select', 'options' => ['admin' => 'Admin', 'user' => 'User']],
['column' => 'created_at', 'type' => 'date'],
['column' => 'active', 'type' => 'boolean']
'export' => ['label' => 'Export', 'route' => 'users.datatable.export']
]"
/>
```

You can now:

- **Search** by typing in the search field.
- **Search**&#x20;
- **Sort** by clicking column headers.
- **Paginate** without page reload.
- **Select rows** individually or choose to select all.
- Filters

---

Expand All @@ -81,15 +85,31 @@ You can define various filters for refining results dynamically.

```blade
:filters="[
['column' => 'name', 'type' => 'text'],
['column' => 'role', 'type' => 'select', 'options' => ['admin' => 'Admin', 'user' => 'User']],
['column' => 'created_at', 'type' => 'date'],
['column' => 'active', 'type' => 'boolean']
['column' => 'name', 'type' => 'input', 'label' => 'Naam'],
['column' => 'email', 'type' => 'input', 'label' => 'Email'],
['column' => 'created_at', 'type' => 'date', 'label' => 'Aangemaakt op'],
['column' => 'email_verified_at', 'type' => 'checkbox', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
['column' => 'email_verified_at', 'type' => 'select', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd']
]"
```

---

## Sorting

Sorting is enabled by default. Clickable column headers allow users to sort the data in ascending or descending order.

By default, sorting is applied to the first column in the `:columns` array. If needed, sorting can be applied programmatically by setting:

```php
'sortColumn' => 'created_at',
'sortDirection' => 'desc',
```

Sorting is supported for all columns in the dataset, including text, dates, and booleans.

---

## Actions & Bulk Actions

### Row Actions
Expand Down Expand Up @@ -139,3 +159,4 @@ We welcome improvements to code quality, new features, or better documentation.
## License

Ginkelsoft DataTables is open-sourced software licensed under the [MIT license](LICENSE).