1- # Ginkelsoft DataTables
1+ # Ginkelsoft DataTables version 0.0.9
22
33Ginkelsoft 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.
44
@@ -10,10 +10,11 @@ Ginkelsoft DataTables is a flexible and easy-to-use package for managing tabular
10102 . [ Installation] ( #installation )
11113 . [ Usage With Livewire] ( #usage-with-livewire )
12124 . [ Filters] ( #filters )
13- 5 . [ Actions & Bulk Actions] ( #actions--bulk-actions )
14- 6 . [ Additional Features] ( #additional-features )
15- 7 . [ Contributing] ( #contributing )
16- 8 . [ License] ( #license )
13+ 5 . [ Sorting] ( #sorting )
14+ 6 . [ Actions & Bulk Actions] ( #actions--bulk-actions )
15+ 7 . [ Additional Features] ( #additional-features )
16+ 8 . [ Contributing] ( #contributing )
17+ 9 . [ License] ( #license )
1718
1819---
1920
@@ -48,30 +49,33 @@ This package **requires Livewire** and cannot be used without it. To integrate D
4849``` blade
4950<livewire:datatable
5051 model="App\\Models\\User"
51- :columns="['id', 'name', 'email']"
52+ :columns="['id', 'name', 'email', 'created_at']"
53+ :hidden-columns="['id']"
54+ :filters="[
55+ ['column' => 'name', 'type' => 'input', 'label' => 'Naam'],
56+ ['column' => 'email', 'type' => 'input', 'label' => 'Email'],
57+ ['column' => 'created_at', 'type' => 'date', 'label' => 'Aangemaakt op'],
58+ ['column' => 'email_verified_at', 'type' => 'checkbox', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
59+ ['column' => 'email_verified_at', 'type' => 'select', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
60+ ]"
5261 :actions="[
53- ['label' => 'Edit', 'route' => 'users.edit'],
54- ['label' => 'Delete', 'route' => 'users.destroy']
62+ ['name' => 'edit', 'label' => 'Edit', 'route' => 'users.datatable.export'],
63+ ['name' => 'delete', 'label' => 'Delete', 'route' => 'users.datatable.export'],
64+ ['name' => 'view', 'label' => 'View Profile', 'url' => '/users/{id}']
5565 ]"
5666 :bulkActions="[
57- 'delete' => ['label' => 'Delete', 'route' => 'users.bulk.delete'],
58- 'export' => ['label' => 'Export', 'route' => 'users.bulk.export']
59- ]"
60- :filters="[
61- ['column' => 'name', 'type' => 'text'],
62- ['column' => 'role', 'type' => 'select', 'options' => ['admin' => 'Admin', 'user' => 'User']],
63- ['column' => 'created_at', 'type' => 'date'],
64- ['column' => 'active', 'type' => 'boolean']
67+ 'export' => ['label' => 'Export', 'route' => 'users.datatable.export']
6568 ]"
6669/>
6770```
6871
6972You can now:
7073
71- - ** Search** by typing in the search field.
74+ - ** Search** &#x 20 ;
7275- ** Sort** by clicking column headers.
7376- ** Paginate** without page reload.
7477- ** Select rows** individually or choose to select all.
78+ - Filters
7579
7680---
7781
@@ -81,15 +85,31 @@ You can define various filters for refining results dynamically.
8185
8286``` blade
8387:filters="[
84- ['column' => 'name', 'type' => 'text'],
85- ['column' => 'role', 'type' => 'select', 'options' => ['admin' => 'Admin', 'user' => 'User']],
86- ['column' => 'created_at', 'type' => 'date'],
87- ['column' => 'active', 'type' => 'boolean']
88+ ['column' => 'name', 'type' => 'input', 'label' => 'Naam'],
89+ ['column' => 'email', 'type' => 'input', 'label' => 'Email'],
90+ ['column' => 'created_at', 'type' => 'date', 'label' => 'Aangemaakt op'],
91+ ['column' => 'email_verified_at', 'type' => 'checkbox', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd'],
92+ ['column' => 'email_verified_at', 'type' => 'select', 'options' => ['1' => 'Verified', 'null' => 'Not Verified'], 'label' => 'Email bevestigd']
8893]"
8994```
9095
9196---
9297
98+ ## Sorting
99+
100+ Sorting is enabled by default. Clickable column headers allow users to sort the data in ascending or descending order.
101+
102+ By default, sorting is applied to the first column in the ` :columns ` array. If needed, sorting can be applied programmatically by setting:
103+
104+ ``` php
105+ 'sortColumn' => 'created_at',
106+ 'sortDirection' => 'desc',
107+ ```
108+
109+ Sorting is supported for all columns in the dataset, including text, dates, and booleans.
110+
111+ ---
112+
93113## Actions & Bulk Actions
94114
95115### Row Actions
@@ -139,3 +159,4 @@ We welcome improvements to code quality, new features, or better documentation.
139159## License
140160
141161Ginkelsoft DataTables is open-sourced software licensed under the [ MIT license] ( LICENSE ) .
162+
0 commit comments