This document provides an overview of the configuration options available for Ginkelsoft DataTables.
The configuration file can be found at:
config/datatable.php
If the file is not present, you can publish it using:
php artisan vendor:publish --provider="Ginkelsoft\DataTables\DataTableServiceProvider" --tag=config
Key | Default Value | Description |
---|---|---|
per_page.active |
true |
Enables or disables pagination options. |
per_page.options |
[10, 25, 50, 100] |
Available options for rows per page. |
per_page.default |
10 |
Default number of rows per page. |
sort.active |
true |
Enables or disables sorting. |
sort.column |
'id' |
Default sorting column. |
sort.direction |
'asc' |
Default sorting order (asc or desc ). |
columns.hidden |
[] |
An array of column names that should be hidden by default. |
filters.active |
true |
Enables or disables filter functionality. |
row_actions.view |
'datatable::row-actions' |
Blade view for row actions. |
bulk_actions.active |
true |
Enables or disables bulk actions. |
search.active |
true |
Enables or disables the search feature. |
To update the configuration, modify the values in config/datatable.php
:
return [
'per_page' => [
'active' => true,
'options' => [10, 25, 50, 100],
'default' => 25,
],
'sort' => [
'active' => true,
'column' => 'created_at',
'direction' => 'desc',
],
'columns' => [
'hidden' => ['updated_at'],
],
'filters' => [
'active' => true,
],
'row_actions' => [
'view' => 'datatable::custom-row-actions',
],
'bulk_actions' => [
'active' => false,
],
'search' => [
'active' => true,
],
];
After making changes, clear the configuration cache:
php artisan config:clear
php artisan cache:clear
To retrieve configuration values in your application, use the config()
helper: