Ginkelsoft DataTables allows you to hide specific columns from being displayed in the table while still making them available for backend processing. This is useful when you need to store extra information in the dataset without showing it to the user.
To hide specific columns, use the :hidden-columns
attribute in your Livewire component:
<livewire:datatable
model="App\Models\User"
:columns="['id', 'name', 'email', 'created_at']"
:hidden-columns="['id', 'email']"
/>
In this example:
The id
and email
columns are hidden from the displayed table.
These columns are still accessible in the backend for actions, filtering, and exports.
Hidden columns are still included in database queries: Even though they are not displayed, they are still fetched and can be used in filters, actions, and bulk actions.
Cannot be toggled by the user: Unlike visibility toggles in some table components, hidden columns in Ginkelsoft DataTables are defined at the component level and cannot be toggled dynamically by the end-user.
Useful for processing: You can use hidden columns for backend logic, such as storing user IDs for actions or handling relational data without displaying it.
If you need to delete a user based on their id
, but you don’t want to show the id
column in the table:
<livewire:datatable
model="App\Models\User"
:columns="['id', 'name', 'email', 'created_at']"
:hidden-columns="['id']"
:actions="[
['label' => 'Delete', 'route' => 'users.destroy', 'params' => ['id']]
]"
/>
Even though the id
column is hidden, it is still available for the delete action.
Use :hidden-columns
to specify columns that should not be displayed.
Hidden columns remain available for backend logic.
They cannot be toggled by the user.
Helps keep the UI clean while still allowing advanced processing.
This feature ensures your table remains user-friendly while retaining the necessary data for actions and filtering.