Download the PHP package nongbit/codeigniter-datatable without Composer
On this page you can find all versions of the php package nongbit/codeigniter-datatable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nongbit/codeigniter-datatable
More information about nongbit/codeigniter-datatable
Files in nongbit/codeigniter-datatable
Package codeigniter-datatable
Short Description Server-side DataTables integration for CodeIgniter 4.
License MIT
Informations about the package codeigniter-datatable
CodeIgniter 4 DataTable
Server-side DataTables integration for CodeIgniter 4.
PHP only – you write your own frontend (plain JS, jQuery, or any tool).
Requirements
- PHP 8.1+
- CodeIgniter 4.4+
- Composer
Installation
Usage
Use DataTableTrait (recommended) or instantiate DataTable directly.
Complex Queries (Where, Join, Group By, Order By)
You can modify the BaseBuilder before passing it to datatable(). All query conditions will be respected.
Example with WHERE and JOIN
Example with GROUP BY and HAVING
Example with Complex WHERE Conditions
Example with Raw SQL Conditions
Important: The package automatically adds
LIMITandOFFSETfor pagination, and appliesLIKEconditions for searching. It does not remove any existingWHERE,GROUP BY,HAVING, orORDER BYclauses. However, if you specify anORDER BYand DataTables sends its own ordering, both will be applied (your default ordering first, then DataTables ordering). To avoid conflicts, consider removingorderBy()from the builder if you want DataTables to fully control ordering.
Without Trait (Direct Instantiation)
Column Formatting with Callbacks
Use setCallback() to transform column data before sending to the frontend.
The callback receives $value (raw column value) and $row (full record array).
Important Notes
- The package automatically handles searching, ordering, and pagination based on DataTables request parameters.
- DataTables individual column search (
columns[i][search][value]) is supported. - For complex queries with table aliases or joins, set the
nameattribute in your DataTables column definition to avoid ambiguous column names (e.g.,{ data: 'customer_name', name: 'c.name' }). - The builder is cloned internally to prevent side effects.
- If you use parameterized
where()clauses, bindings are preserved in the clone – this is usually safe.
Troubleshooting
Ambiguous column name in ORDER BY
If you get an error like Column 'id' in order clause is ambiguous, set the name attribute in your DataTables column definition:
Custom search logic
The package uses LIKE for searching. If you need different logic (e.g., full-text search), extend the class or modify the builder before passing.
Bonus: Integration with Vite
If you use nongbit/codeigniter-vite, you can write your own datatable.js and import it into your Vite entry point. Example:
Then in your view: <?= vite('app') ?>.
This package provides no frontend assets; you are free to use CDN, Vite, or any other method.
License
MIT