Installation
Install the Bundle
Install via Composer
composer require pentiminax/ux-datatablesSymfony Flex will automatically enable the bundle.
Install Assets
Verify Installation
The @pentiminax/ux-datatables/datatable Stimulus controller is now available in your application.
Bundle Configuration
Create a configuration file at config/packages/data_tables.yaml:
data_tables:
options:
language: en-GB
layout:
topStart: pageLength
topEnd: search
bottomStart: info
bottomEnd: paging
lengthMenu: [10, 25, 50]
pageLength: 10
template_parameters:
class: 'table'
extensions:
buttons: [csv, excel, pdf, print]
select:
style: single
Configuration Options
| Option | Description |
|---|---|
| language | Default language locale (e.g., en-GB, fr-FR) |
| layout | UI component positions (topStart, topEnd, bottomStart, bottomEnd) |
| lengthMenu | Available page length options |
| pageLength | Initial rows per page |
| template_parameters | Default attributes for the <table> element |
| extensions | Default extensions to enable |
Styling
Default Styles
The bundle includes default DataTables styling. Check your assets/controllers.json:
{
"controllers": {
"@pentiminax/ux-datatables": {
"datatable": {
"enabled": true
}
}
},
"autoimport": {
"datatables.net-dt/css/dataTables.dataTables.min.css": true
}
}
Using Bootstrap
To use Bootstrap 5 styling instead:
{
"autoimport": {
"datatables.net-dt/css/dataTables.dataTables.min.css": false,
"datatables.net-bs5/css/dataTables.bootstrap5.min.css": true
}
}
Optional Dependencies
| Package | Feature |
|---|---|
| `symfony/form` | Inline edit modal with auto-generated forms |
| `symfony/twig-bundle` | Required for rendering edit forms |
| `api-platform/core` | Auto-detect columns from API Platform metadata |
| `symfony/mercure-bundle` | Real-time table updates via Mercure SSE |
| `symfony/maker-bundle` | The `make:datatable` console command |