Installation

Install the Bundle

Install via Composer

composer require pentiminax/ux-datatables

Symfony 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
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

The bundle ships with the DataTables default theme enabled. Check your assets/controllers.json:

{
  "controllers": {
    "@pentiminax/ux-datatables": {
      "datatable": {
        "enabled": true,
        "autoimport": {
          "datatables.net-dt/css/dataTables.dataTables.min.css": true,
          "datatables.net-bs5/css/dataTables.bootstrap5.min.css": false
        }
      }
    }
  }
}

The bundle supports 7 CSS frameworks (Bootstrap 5, Bootstrap 4, Bulma, Foundation, and more). The Stimulus controller automatically detects which stylesheet is loaded and applies the matching integration.

See Styling for the full setup guide.

Optional Dependencies

Package Feature
`symfony/form`Inline edit modal with auto-generated forms
`symfony/twig-bundle`Required for rendering edit modal templates
`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