Update again: Several hours later I tried many things and decided to switch DataTables Get to a POST and that fixed it. Hopefully this will help someone.
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"sAjaxSource": "<?php //echo base_url();?>clients/ClientsSource"
} );
} );
Update: After 6 hours I finally decided to use the script that is on DataTables website here, http://www.datatables.net/release-datatables/examples/data_sources/server_side.html, and then it worked right away. It appears that sEcho is working right on one script and not the other:
{"sEcho":1,"iTotalRecords":"50","iTotalDisplayRecords":"50","aaData":[["1","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["2","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["3","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["4","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["5","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["6","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["7","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["8","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["9","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["10","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"]]}
PS. the events did work but nothing happened.. now it does though.
bServerSide does need to be true.
Hi, I have your wrapper in and working now, but none of the events work. The drop down length and the pagination buttons do not work. I saw a guy with a similar is around post 248 or so. i ended up having it call the controller which calls the model and echos the ajax data back. Works I think.
It has 50 entries in the DB and I get this “Showing 1 to 10 of 10 entries”
It should be Showing 1 to 10 of 50 entries I would think.
any thoughts? Is this error on my end, the wrapper, or datatables?
Here is the JSON returned:
{"sEcho":0,"iTotalRecords":"50","iTotalDisplayRecords":"50","aaData":[["1","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["2","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["3","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["4","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["5","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["6","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["7","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["8","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["9","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"],["10","MyFirst","MyLast","MyOrg","MyAddress","MyCity","MyState","MyZip"]],"sColumns":"id,first_name,last_name,organization,address,city,state,zip"}
Here is my JS.
[removed]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "<?php echo base_url();?>clients/ClientsSource"
} );
} );
[removed]