I’m having problem with IgnitedDatatables-native-php-version.
I’m using MySQLi and getting this error:
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in xxx/scripts/datatables/dataTables.ignition.php on line 64
note: The latest official datatables also includes distinct and or_where functions. It doesnt fit those functions in this library.
If you want to use or_where function simply :
->where(' (length = "46" OR length = "47") ' ,NULL,FALSE)
I have a problem with jquery datatables when I use group_by. The data loaded in the datatable are correct but records count shown in the footer of the datatable is bad. Can somebody help me with this?
Thanks
Totally new to this. I want to use on the application I am developing. This is a great library. Can someone give me a working example? Or just a tutorial link? I also want to add 1 column at the end for actions(select/delete) thanks
Totally new to this. I want to use on the application I am developing. This is a great library. Can someone give me a working example? Or just a tutorial link? I also want to add 1 column at the end for actions(select/delete) thanks
This CI library is built around the ‘server side’ data source as seen in this example. It doesn’t include DataTables itself. What you’re asking about is more a DT related question, to which I’m sure you’ll find all the info you need in documentation on DataTables.net.
I have datatables working on plain php but now i want to use it in codeigniter. So I came over here and found this. If this is not what I’m looking for, can you give me links/tutorials/samples how to implement datatables in codeigniter?
I want to add a column at the end for ‘Actions’
add_coumn is not working
Ah, I see what you mean now. Sorry, I misunderstood your first post.. My mistake.
Just to confirm, is this code in your controller or your model? Is the data getting through if you try without the add_column() method in the chain?
If I remember correctly, when I tried this I only got it to work after using print() at the end of the $this->datatables() chain. Here’s the relevant code from a recent project I worked on:
// MY_Controller function get_list() { $this->load->model('my_model'); $this->my_model->get_list(); }
// MY_Model public function get_list() { $this->datatables->select(' Table.Col1, Table.Col2, Table.Col3 '); $this->datatables->from('Table');
print($this->datatables->generate()); }
In this case, I set the AJAX source in my DT initialization to a url generated by:
echo(base_url('my_controller/get_list'));
Not sure if there’s a better way to do this, but this worked for me. Just a thought, but maybe try use print() instead of echo() on your generate() line.
I want to add a column Action after the ‘Date Registered’. Content of it will be icon disable user, promote/remove as admin.
I suspect the biggest issue here is the fact that the number of columns between your data source (in your controller) and the number of columns in your end table (in your view), do not match. You’re trying to put data for 8 columns into a 7 column table. Out of curiosity, have you tried adding an extra column to your HTML table in your view? Sometimes the simplest solution works out best in the end.
Unfortunately though, DataTables itself doesn’t support dynamically adding columns, this question has been asked many times on the DT forum in the past. Digging through these questions again this morning, I found a link to a tutorial that looks like it does exactly what you’re asking for [link].
Otherwise, have you considered using something like the drill-down rows example, placing the ‘user specific functions’ in the row that shows up below the clicked row? This way, the data is added dynamically to the row before it’s displayed, and the row is destroyed after it’s hidden. It’s very easy to use and very efficient as well.
This is giving me ideas for another project I’m working on now.. Time to go play. (: