Welcome Guest, Not a member yet? Register   Sign In
DataTables 1.10 > Library
#1
Smile 

I just pushed a new DataTables library that I created for a project I have been working on.  It is well documented on github.  Head on over and let me know what you think.   Big Grin

https://github.com/zepernick/Codeigniter-DataTables

Features
  • Generates Necessary JSON For Sever Side Tables
  • Handles Sorting & Column Based Searching
  • Builds the select automatically from the DataTable column names
  • Append custom SQL expressions to the generated Select statement
  • Append a static where clause
  • Formatters For Date, Percent, Currency, and Boolean
  • Utilizes CI Active Record
  • Drastically Reduces PHP Code Necessary To Generate a Server Side Table

Here is a example of the Controller.

PHP Code:
class DataTableExample extends CI_Controller {
 
   public function dataTable() {
 
       //Important to NOT load the model and let the library load it instead.  
 
       $this -> load -> library('Datatable', array('model' => 'state_dt''rowIdCol' => 'c.id'));

 
       //format array is optional, but shown here for the sake of example
 
       $json $this -> datatable -> datatableJson(
 
           array(
 
               'a_date_col' => 'date',
 
               'a_boolean_col' => 'boolean',
 
               'a_percent_col' => 'percent',
 
               'a_currency_col' => 'currency'
 
           )
 
       );

 
       $this -> output -> set_header("Pragma: no-cache");
 
       $this -> output -> set_header("Cache-Control: no-store, no-cache");
 
       $this -> output -> set_content_type('application/json') -> set_output(json_encode($json));

 
   }


Reply


Messages In This Thread
DataTables 1.10 > Library - by zepernick - 01-09-2015, 12:20 PM
RE: DataTables 1.10 > Library - by Rufnex - 01-09-2015, 12:41 PM
RE: DataTables 1.10 > Library - by zepernick - 01-09-2015, 12:56 PM
RE: DataTables 1.10 > Library - by zepernick - 01-10-2015, 05:46 AM
RE: DataTables 1.10 > Library - by Rufnex - 01-10-2015, 08:31 AM
RE: DataTables 1.10 > Library - by zepernick - 01-12-2015, 07:07 AM
RE: DataTables 1.10 > Library - by GrigoreMihai - 02-03-2015, 08:11 AM
RE: DataTables 1.10 > Library - by zepernick - 02-03-2015, 06:44 PM
RE: DataTables 1.10 > Library - by marcelo - 02-03-2015, 09:25 AM
RE: DataTables 1.10 > Library - by yufieko - 04-13-2015, 05:25 AM
RE: DataTables 1.10 > Library - by zepernick - 04-13-2015, 07:13 AM
RE: DataTables 1.10 > Library - by kaederukawa7 - 05-17-2015, 10:05 PM
RE: DataTables 1.10 > Library - by kaederukawa7 - 05-17-2015, 10:08 PM
RE: DataTables 1.10 > Library - by RWCH - 03-10-2016, 07:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB