Skip to content

Installation

Installation

Install the Bundle

  1. Install via Composer

    Terminal window
    composer require pentiminax/ux-datatables

    Symfony Flex will automatically enable the bundle.

  2. Install Assets

    If you’re using AssetMapper (recommended for Symfony 6.4+), no extra work is needed. The bundle ships DataTables assets automatically.

  3. Verify Installation

    The @pentiminax/ux-datatables/datatable Stimulus controller is now available in your application.

Bundle Configuration

Create a configuration file at config/packages/datatables.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

OptionDescription
languageDefault language locale (e.g., en-GB, fr-FR)
layoutUI component positions (topStart, topEnd, bottomStart, bottomEnd)
lengthMenuAvailable page length options
pageLengthInitial rows per page
template_parametersDefault attributes for the <table> element
extensionsDefault 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
}
}