Problem

DataTables currently hardcodes the parameter name id for identifying table instances in AJAX requests (line 417 in DataTables.php):

"function(d) {
    d.id = '{$this->name}';
    // ...
}"

This causes conflicts with frameworks that use id as a reserved parameter (e.g., for page IDs, record IDs). Validation errors occur when the framework expects id to be an integer but receives a string like "DataTables_1".

Proposed Solution

Add a new configuration option ajaxIdParam (default: 'id') to allow users to customize the parameter name:

DataTables::create([
    'serverSide' => true,
    'ajaxIdParam' => 'dtId', // Custom parameter name instead of 'id'
    // ... other options
]);

Implementation

File: vendor/koolreport/datagrid/DataTables.php

Change 1: Line ~417 (AJAX data function)

// BEFORE:
'data' => "function(d) {
    d.id = '{$this->name}';

// AFTER:
$ajaxIdParam = Util::get($this->params, 'ajaxIdParam', 'id');
'data' => "function(d) {
    d.{$ajaxIdParam} = '{$this->name}';

Change 2: Line ~1508 (Server-side request parsing)

// BEFORE:
$id = Util::get($request, 'id', null);

// AFTER:
$ajaxIdParam = Util::get($this->params, 'ajaxIdParam', 'id');
$id = Util::get($request, $ajaxIdParam, null);

Benefits

  1. Backward compatible: Defaults to 'id' - existing code works unchanged
  2. Simple: Single configuration option, ~4 lines of code
  3. Solves real-world issue: Eliminates parameter name conflicts with frameworks
  4. Minimal risk: Only affects parameter name, not functionality

Use Case

// Works with frameworks that reserve 'id' parameter
DataTables::create([
    'serverSide' => true,
    'ajaxIdParam' => 'tableId', // No conflict with framework's 'id' parameter
    'ajaxUrl' => '?action=getData',
    // ...
]);

Urgency

Affects integration with many PHP frameworks (Laravel, Symfony, custom CMSes) that use id as a standard parameter.

Current Workaround: Manual patching of vendor files (not ideal for composer updates)

As a long time pro customer we really would like this to be fixed.