DataTables Library
The documentation is constantly evolving and updated alongside the project's progress. Since it is developed in parallel with the code, some sections may temporarily refer to earlier versions of the system-these are gradually adapted to the current state of the application. If you notice any outdated information, please report it or open an Issue / Pull Request.
Documentation
# DataTables Library
DbM\DataTables is a standalone PHP library maintained with DBM Platform. It provides reusable backend and rendering components for database-backed tables. It is separate from the DBM Framework runtime, although platform applications can integrate it with their repositories, database adapter, HTTP request, and templates.
# Main components
DataTableParamsis an immutable value object for the current page, page size, sort key, direction, and filters.fromRequest()acceptspage,per_page,sort, anddir, as well as filters infilter[key]orfilter_keyform. Global search is normalized to thequeryfilter and acceptsqas an input alias.DataTableServicepaginates through aRepositoryInterface(paginate()) or a supplied database adapter and a raw SELECT (paginateRaw()). Raw queries use explicit sortable, filterable, and searchable alias maps. Pagination, filtering, sorting, and count results are returned inDataTableResult.ConfigDataTableInterfacesupplies the table schema and application-specific filters, buttons, custom rows, rendering mode, and request URL.DataTableRendererbuilds the table markup and response data.ApiDataTableResponseBuilderselects the PHP, AJAX, or API response path according to the configuration.- Database and repository interfaces keep persistence integration replaceable; the library also has an HTTP request abstraction and a small translator utility.
# Integration outline
Create an application configuration implementing ConfigDataTableInterface, provide a compatible repository or database adapter, parse incoming query parameters with DataTableParams::fromRequest(), and pass the resulting data to the renderer or response builder. Keep SQL aliases used in raw pagination mapped explicitly; do not derive SQL identifiers directly from request values.
The configuration contract names PHP, AJAX, and API modes, and the response builder contains paths for each. However, the current renderer includes a non-PHP availability restriction, so verify the installed edition and current library behavior before relying on AJAX/API rendering. This library is proprietary and subject to the DBM Platform license.