CodeIgniter DataTable Library
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
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?
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.
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.
Well pzepernick that’s good. i am going to use this library in my project. just one question.. the grid not works well with the responsive.. and i don’t want separate search bar for every column .. how can i do this?
I have a plugin for DataTables that I wrote which adds search boxes to the columns and works with the responsive plugin. It will automatically hide the search field if the column is being hidden. Check it out and let me know what you think. https://github.com/zepernick/Plugins/tree/master/features/columnSearchField
Hi pzepernick,
Great work, but i have the same problem with HMVC, your library doesn’t recognise the columns ->line 163
Are you performing a POST in your ajax call? Checkout the link below to setup DataTables to perform a POST in the ajax call.
https://datatables.net/examples/server_side/post.html
I see that DataTables is defaulting to GET. I should probably change the library to work with either.
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
I will update the example with the single select box when I have a few moments.
Thanks,
Paul
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
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
Hey Paul,
great job!
Can you describe how to add and use datatables.net plugins?
Thanks
Stefan
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.
Hi, any chance you will rewrite your library for CodeIgniter 3 + DataTables or even better CodeIgniter 3 + DataTables + Editor?
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
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.
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.
can you show us how to melti select from the tables and save them to a single column in a database ?
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 🙂
Hi There
i think it is a greate library for retirving but, it would be awesome if it allows to multiselect and save to database as a single column like this (http://www.gyrocode.com/articles/jquery-datatables-row-selection-using-checkboxes-and-select-extension/comment-page-1/#comment-6600)
thnaks
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?