1. Go to this page and download the library: Download rifa/codeigniter-datatables library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rifa / codeigniter-datatables example snippets
use \Rifa\DataTables\DataTable;
public function ajaxDatatable()
{
$db = db_connect();
$builder = $db->table('customers')->select('customerNumber, customerName, phone, city, country, postalCode');
return DataTable::of($builder)->toJson();
}
use \Rifa\DataTables\DataTable;
use \App\Models\CustomerModel;
public function ajaxDatatable()
{
$customerModel = new CustomerModel();
$customerModel->select('customerNumber, customerName, phone, city, country, postalCode');
return DataTable::of($customerModel)->toJson();
}