Demo of Dtable Library for Codeigniter and Datatables

Implementing datatables with server side pagination has always been a headache for developers but this codeinigter based library makes it extremely simple and efficient. Three examples demonstrate how to list records from, three, two and a single table respectively. You can clone or download the examples from Github [https://github.com/sajjadsaleem/datatable-codeigniter ]. Follow these steps to make it work.>

  1. Create a new or use an existing codeigniter installation.
  2. Import SQL [https://github.com/sajjadsaleem/datatable-codeigniter/blob/master/demo/sql/dev4_dtable_example.sql].
  3. Put Dtable.php [https://github.com/sajjadsaleem/datatable-codeigniter/blob/master/Dtable.php] in application/libraries directory.
  4. Create a Controller [https://github.com/sajjadsaleem/datatable-codeigniter/blob/master/demo/application/controllers/vehicle.php].
  5. Create a view [https://github.com/sajjadsaleem/datatable-codeigniter/blob/master/demo/application/views/dtable_page.php].
  6. Load the view in your in your controller. You will also need a new function in your controller, which will receive dtable pagination params and out the json format of required data.
  7. Include jquery and CDN libararies. You can use the following CDNs.
    1. JS: http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
    2. CSS: //code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css
    3. CSS: //cdn.datatables.net/1.10.5/css/jquery.dataTables.min.css
    4. CSS: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
    5. JS: //cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js
    6. JS: //code.jquery.com/ui/1.11.2/jquery-ui.js
    7. JS: //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
  8. Views and controllers are explained briefly with every example.

This demo uses one codeigniter (Dtable) library, one view and one controller. The view contains HTML and JavaScript while the controller and a dtable library is used to output json data of records to be parsed by great Datatables JS Library . And of course, don't forget to include Jquery and Datables libraries. Also, include

If you have any question, you can email me at sajjad@barqsol.com or you can create an issue on Github[https://github.com/sajjadsaleem/datatable-codeigniter/issues]

DataTable Example

Item ID Name Colour Engine type Assembled Make

HTML :

Javascirpt:

Now in controller named as "Vehicle" we will create a function "get_dtable_data".

DataTable Example2

Model ID Name Make

HTML :

Javascirpt:

Now in controller we will create a function named as "get_dtable_data_exp_2".

DataTable Example3

Make ID Make Name

HTML :

Javascirpt:

Now in controller we will create a function named as "get_dtable_data_exp_3".