Sunday, February 26, 2012

jQuery Datatables plugin and Codeigniter


Just got an work around for the jQuery datatables wrapper [IgnitedDatatables] and made it working on a project to load huge data. As I din get any neat info I had to dig little deep both into datatables plugin and the wrapper and finally made a work around for me. Here in this post I am basically sharing my experience along with keeping records of what and how I did :)
The js I am using on the view to create the datatable and load using ajax is as follow [don try to run on jsFiddle 'cz it has lots of garbage- will clean it up :| ] :


Code on the controller:


And finally the model:


I will write in details on it - how I actually worked on later on this post.
Tips:
  1. For the callback function for the wrapper to work you need to create a helper file where you need to put all the callback functions.
  2. As the wrapper somewhat works as the model should work I have called and made use of it in my model class.
Reference:
  1. jQuery Datatables plugin api
  2. Server side data processing using Datatables plugin
  3. IgnitedDatatables function reference; and Method Chaining example
  4. Example usage code for the IgnitedDatatables library [independent of Codeigniter]
  5. Sample MySql Database [Sakila :)]

3 comments:

  1. Please could you share your code ? #Downloadable.
    I would really like the code please

    ReplyDelete
  2. Code pls.. Nothing is clear here

    ReplyDelete
  3. :) What is not clear ?! All is referenced here is code. Please let me know if you further assistance. I will love to help.

    ReplyDelete