Type to search columns, filters, options, and extensions.

↑↓ to navigate · Enter to open · Esc to close

Documentation

Installation

How to install and configure UX DataTables

Requirements

Install the Bundle

    Install via Composer

    composer require pentiminax/ux-datatables

    Symfony Flex will automatically enable the bundle.

    Install Assets

    AssetMapper

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

    Webpack Encore

    If you’re using Webpack Encore, install the JavaScript dependencies and rebuild your assets:

    npm install --force
    npm run watch

    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
  table_attributes:
    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
table_attributesDefault 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 4 CSS frameworks (Bootstrap 5, Bootstrap 4, Bootstrap 3, and the default DataTables theme). The Stimulus controller automatically detects which stylesheet is loaded and applies the matching integration.

See Styling for the full setup guide.

Optional Dependencies

PackageFeature
symfony/formInline edit modal with auto-generated forms
symfony/twig-bundleRequired for rendering edit modal templates
api-platform/coreAuto-detect columns from API Platform metadata
symfony/mercure-bundleReal-time table updates via Mercure SSE
symfony/maker-bundleThe make:datatable console command