CodeIgniter DataTable Library

CodeIgniter DataTable Library

23 26225

I have been working on a project in PHP / CodeIgniter that I CANNOT wait to tell you guys about…

I have been developing some sweet CI libraries for this project and have decided to give some of them back to the community.   This is my first PHP open source contribution and my first solo Github project.

The CodeIgniter DataTable library handles all the DB operations for searching, sorting, paging, etc a jQuery DataTable.  The project can be found on GitHub CodeIgniter-DataTables.

This weekend I will be working on a CI example application that uses this library, and will update this post when it is available.  I have some other useful libraries that will be rolling out soon so stay tuned…
***Update: A full working example can be found here

SIMILAR ARTICLES

23 COMMENTS

  1. Thanks for your work concerning CodeIgniter Datatables.
    really a great help.

    I tried to “change” your code to make it work with CodeIgniter 2.2 (I’m using HMVC in all my apps).
    Though, I’m having a problem with the “mimes”

    Severity: Notice

    Message: Undefined variable: mimes

    Filename: core/Output.php

    Line Number: 107

    Do you have any idea ?
    (in other words … could you make your version working with CI 2.2 HMVC ?)

    Thanks in advance for your reply,

    JOhnny

    • To be completely honest, I don’t have any experience with HMVC. I just started to look at it. Are you still extending their class in your controller? Are you using these lines in your controller?

       $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));
      

      My guess is that something is going wrong in the set_content_type because that is what is setting the mime type. Does HMVC have a different way of sending JSON output back to the client? I think it is just something that needs to be changed in the controller and not in the library.

      Maybe try to echo the json after the method call to the library just to debug and verify that the exception is not happening within the library and it is in the controller as I suspect.

          $json = $this -> datatable -> datatableJson(...);
          echo $json;
      
  2. Hi pzepernick,

    a many thanks for the great script and demo.. i am going to use this in my project. can you help me or guide me for how to use editors function like add , edit ,delete for datatables in codeigniter?

    i also ask @Allan Jardine a datatable developer. he told me he didn’t made any library for editors yet. any help would be appreciated. i really want this demo work with my codeigniter.

    http://editor.datatables.net/examples/simple/simple.html

    • Hi Meet,

      Unfortunately I do not have any experience with the editor. I tried to look at the docs, but apparently you need a license for that as well. Afraid I am not much help on this one, sorry.

  3. Hi pzepernick,

    Great work, but i have the same problem with HMVC, your library doesn’t recognise the columns ->line 163

  4. Hi Paul,

    Just a question concerning column search.
    Currently, your example works with textboxes. (super fast, and many options… thanks !)

    Is there a possibility to have other controls-types on top of a column ?

    e.g. See your application on http://www.paulzepernick.com/ci-zepernick/
    it would be great if we could have a (multi) select listbox above the ‘status’ column in your application.

    Thanks in advance for your reply,

    Johnny

    • Hi Johnny,

      Yes, it is possible to have other controls beside text boxes. You can do a single select with the current library. A multi-select will require a enhancement to the library. I will take a look at adding the option for multi-select as a enhancement. The JavaScript library I sent to you has the ability to put a single select box instead of the text box. It will take a string array for the options, optionally you can defined a callback function that hands in the select box. you can then create your own option elements and append them to the select.

      Paul

  5. Hi Paul,

    Your Library rocks !

    Just one more question concerning column searches…
    You’re working with textboxes on top of each column.
    Is there a possibility to use e.g. (multi) select listboxes ?

    Thanks in advance for your reply,

    Johnny

  6. Hey Paul,
    I guess so far you haven’t updated the example download with the latest code?
    I am interested in that option select boxes too.

    Best wishes

    Stefan

  7. Hello Paul, I am loving your work so far and enjoying it; however, I am facing a serious challenge when it comes to making certain cells clickable. I will be more than glad if you can guide me on how to make certain output from the database clickable (buttons) and how to modify certain elements such as dates to suite my current dates (which are human friendly compared to mysql dates). I look forward to hearing from you.

  8. Hi, any chance you will rewrite your library for CodeIgniter 3 + DataTables or even better CodeIgniter 3 + DataTables + Editor?

  9. I want to show 500 data in initial table.but i want to search the whole data like 100000.That means, i want to use whereClauseArray for the initial table,bu i want to ignore whereClauseArray in column search.
    Thanks

  10. Hello Paul, I searched the Internet and found your example of integration of DataTables with CI, downloaded and am testing for use in an application.
    I confess I’m no expert in CI, and I’m facing some difficulties.
    I’m using MySQL to store the data, and their example has fixed data, how can I do to be able to use your library?
    I changed your model, and a message: invalid JSON Response.

  11. Hello, can you tell how can I add new column in html view to the table like “Actions” column and to have buttons “edit”, “delete”?

    Thanks.

  12. Hi there, can you show us how to melti select from the tables and save them to a single column in a database ?

    thanks in advance 🙂

  13. General Search button is missing. I unhide it from the zepernick.css and it is visible. But searching is not working. It simply process for few seconds but no change in the table. Can u pliz help me out?

Leave a Reply