CodeIgniter Forums
server-side DataTables Library for CodeIgniter4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7)
+--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13)
+--- Thread: server-side DataTables Library for CodeIgniter4 (/showthread.php?tid=78895)

Pages: 1 2


server-side DataTables Library for CodeIgniter4 - hermawan.dev - 03-24-2021

Hello everyone.. 

I’ve created a library to implement the server-side DataTables for codeIgniter4. 

here the link

github: 
https://github.com/hermawanramadhan/CodeIgniter4-DataTables/

documentation & example
https://hermawan.dev/codeigniter4-datatables/welcome

installation with composer (recommended)
installing with composer is recommended because can automatic install dependency.
Code:
composer require hermawan/codeigniter4-datatables


installation manual

just download here https://github.com/hermawanramadhan/CodeIgniter4-DataTables/releases
add download dependency
- this library require php-sql-parser. download here https://github.com/greenlion/PHP-SQL-Parser

rename downloaded library to
php-sql-parser
codeigniter4-datatables
then placed it let say to app/ThirdParty

and then add namespace to $psr4
PHP Code:
$psr4 = [
        APP_NAMESPACE => APPPATH// For custom app namespace
        'Config'      => APPPATH 'Config',
        
'PHPSQLParser'      => APPPATH 'ThirdParty/php-sql-parser/src/PHPSQLParser'//  <-- namespace for php-sql-parser 
        'Hermawan\DataTables'   => APPPATH .'ThirdParty/codeigniter4-datatables/src'// <-- namespace for this library
    ]; 


Example Controller code

code is short and so easy. just use build-in CodeIgniter4 Query Builder

PHP Code:
<?php namespace App\Controllers;

use \
CodeIgniter\Controller;
use \
Hermawan\DataTables\DataTable;

class 
Customers extends Controller
{
    public function 
index()
    {
        return 
view('customers_view');
    }

    public function 
ajaxDataTables()
    {
        
$db db_connect();
        
$builder $db->table('customers')->select('firstName, lastName, phone, address, city, country');
        
        return 
DataTable::of($builder)->toJson();
    }
}

?>

yeah. so many datatable library available on github but I think this will be easiest. because we use powerful build-in CodeIgniter4 query builder.

Thanks
Regards.
Hermawan
https://hermawan.dev


RE: server-side DataTables Library for CodeIgniter4 - manager - 03-24-2021

Hey, good work.
Thanks for sharing and luck.


RE: server-side DataTables Library for CodeIgniter4 - llyimo1920 - 04-15-2021

It's a great library.
It's simple and elegant and i love it.

There are however an issue with documentation Edit/ Format Column. The sauce tab first arguments is specified as anonymous function instead of a column name.

   


RE: server-side DataTables Library for CodeIgniter4 - hermawan.dev - 04-18-2021

(04-15-2021, 01:56 AM)llyimo1920 Wrote: It's a great library.
It's simple and elegant and i love it.

There are however an issue with documentation Edit/ Format Column. The sauce tab first arguments is specified as anonymous function instead of a column name.

Thanks. document already edited.


RE: server-side DataTables Library for CodeIgniter4 - verdian - 08-10-2021

[quote pid="386126" dateline="1618731056"]
awesome bro,...

I want to ask, why if use 'orderBy' , the sorting error

thanks
[/quote]


RE: server-side DataTables Library for CodeIgniter4 - mpoveda - 02-26-2022

Thanks,

question: Do you have a library that uses server-side for searchPanes or searchBuilder, these are the examples:
https://datatables.net/extensions/searchpanes/examples/initialisation/simple.html
https://datatables.net/extensions/searchbuilder/examples/initialisation/simple.html


RE: server-side DataTables Library for CodeIgniter4 - luckmoshy - 02-27-2022

(03-24-2021, 01:36 AM)hermawan.dev Wrote: Hello everyone.. 

I’ve created a library to implement the server-side DataTables for codeIgniter4. 

here the link

github: 
https://github.com/hermawanramadhan/CodeIgniter4-DataTables/

documentation & example
https://hermawan.dev/codeigniter4-datatables/welcome

installation with composer (recommended)
installing with composer is recommended because can automatic install dependency.
Code:
composer require hermawan/codeigniter4-datatables


installation manual

just download here https://github.com/hermawanramadhan/CodeIgniter4-DataTables/releases
add download dependency
- this library require php-sql-parser. download here https://github.com/greenlion/PHP-SQL-Parser

rename downloaded library to
php-sql-parser
codeigniter4-datatables
then placed it let say to app/ThirdParty

and then add namespace to $psr4
PHP Code:
$psr4 = [
        APP_NAMESPACE => APPPATH// For custom app namespace
        'Config'      => APPPATH 'Config',
        'PHPSQLParser'      => APPPATH 'ThirdParty/php-sql-parser/src/PHPSQLParser'//  <-- namespace for php-sql-parser 
        'Hermawan\DataTables'   => APPPATH .'ThirdParty/codeigniter4-datatables/src'// <-- namespace for this library
    ]; 


Example Controller code

code is short and so easy. just use build-in CodeIgniter4 Query Builder

PHP Code:
<?php namespace App\Controllers;

use \
CodeIgniter\Controller;
use \
Hermawan\DataTables\DataTable;

class 
Customers extends Controller
{
 public function 
index()
 {
 return 
view('customers_view');
 }

 public function 
ajaxDataTables()
 {
 
$db db_connect();
 
$builder $db->table('customers')->select('firstName, lastName, phone, address, city, country');
 
 return 
DataTable::of($builder)->toJson();
 }
}

?>

yeah. so many datatable library available on github but I think this will be easiest. because we use powerful build-in CodeIgniter4 query builder.

Thanks
Regards.
Hermawan
https://hermawan.dev

good


RE: server-side DataTables Library for CodeIgniter4 - lokman - 03-03-2024

Great library. I'm using it now.
Thanks


RE: server-side DataTables Library for CodeIgniter4 - InsiteFX - 03-04-2024

Documentation 404 Error Page Not Found!


RE: server-side DataTables Library for CodeIgniter4 - JustJohnQ - 03-04-2024

This may be the correct link to the documentation:
https://codeigniter4-datatables.hermawan.dev/