atsanna / codeigniter4-datatables
DataTables support for CodeIgniter 4.2.x
Fund package maintenance!
Other
Installs: 32
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 2
Open Issues: 3
Type:project
Requires
- php: ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3
- ext-json: *
- codeigniter4/framework: ^4.4
- codeigniter4/settings: ^2.0
- codeigniter4/shield: ^1.0
- components/font-awesome: ^6.2
- league/commonmark: ^2.0
- roave/security-advisories: dev-latest
- spatie/commonmark-highlighter: ^3.0
Requires (Dev)
- codeigniter/coding-standard: ^1.1
- fakerphp/faker: ^1.9
- mikey179/vfsstream: ^1.6
- nexusphp/cs-config: ^3.1
- nexusphp/tachycardia: ^1.0
- phpstan/phpstan: ^1.1
- phpunit/phpunit: ^9.1
- psr/container: ^2.0
- qossmic/deptrac-shim: ^0.24.0 || ^1.0.2
- rector/rector: ^1.0.3
- sebastian/phpcpd: ^6.0.3
- symfony/filesystem: ^5.4
- vimeo/psalm: ^5.20
Suggests
- ext-fileinfo: Improves mime type detection for files
This package is auto-updated.
Last update: 2024-11-10 09:02:19 UTC
README
This is an extension for CodeIgniter 4.2.x to add Datatables support to your application.
Warning: this is a non-functional experimental version!
The purpose is to generate the html table and the javascript function for its management with a few lines of code.
It is possible to define a model to be passed as a dependency in the constructor; this model will be used for the management of columns and queries.
$userModel = new \atsanna\Models\UserModel(); $table = new \atsanna\DataTables\Html\Table( $userModel );
There are many configuration possibilities:
- Enable or disable automatic calculation of column width
- Enable or disable deferred rendering for faster initialization speed
- Enable or disable the table information display field
- Enable or disable column sorting
- Enable or disable table pagination
- Layout button display options
- Enable or disable the display of a 'processing' indicator
- Enable horizontal scrolling
- Enable vertical scrolling
- Allow the table to shrink in height when a limited number of rows are displayed
- Ability to search (filter) feature control
- Enable or disable server side processing
- Enable or disable state saving
- Change the options in the page length selection list
- Set column specific initialization properties
The default configuration can be customized as follows:
$table->getConfiguration() ->setPaging(true) ->setPagingType( 'full_numbers') ->setOrdering(true) ->setInfo(false) ->setSearching(true) ->setLengthMenu('[[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]') ->setAutoWidth(false) ->setScrollX(true);
It is possible to customize the rendering:
$data = [ 'id' => $userModel->table, 'class' => 'table table-striped table-bordered', 'style' => 'width: 100%; margin-left: auto; margin-right: auto;', 'fields' => $userModel->allowedFields, ]; echo $table->render($data);