Datatables - upgrade to 1.10.2 from 1.9.4 - unable to sort or search on table
Datatables - upgrade to 1.10.2 from 1.9.4 - unable to sort or search on table
Hello, I have updated to datatables 1.10.2 from 1.9.4 in order to get new functionality. At the moment, I have kept everything to the Hungarian Style of reference and expect to change to the new camelcode? Anyways, I don't notice any major problems, except that I can no longer sort by clicking on the row header or use the search which worked fine before.
I have a live site available for viewing and testing at: http://bug.ddns.net:81/4threcess/sample-dynamics
login is "test" pword is "abc123"
click on the account tab to view a datatable that should be sortable. We have datatables throughout this site, so looking at admin and a few other places, none of the sorts work.
I am very new to datatables and most of this code was written before I got to this job. I am not sure where to start in resolving this issue and any help would be appreciated.
This is the code that draws the datatable:
var clienttable = $("#clienttable").dataTable({
aoColumns: [
{"sWidth":"40px", "bSortable":true}, //idclient
{"sWidth": "120px", "bSortable":true}, //clientname
{"sWidth": "85px", "bSortable":true}, //clientdottype
{"sWidth": "120px", "bSortable":true}, //parent company
{"sWidth": "100px", "bSortable":true}, //contact
{"sWidth": "100px", "bSortable":false} // contact phone
],
oLanguage: {
sEmptyTable: " "
},
sDom: 'T<"clear">lfrtip',
bProcessing: true,
bAutoWidth: false,
bServerSide: true,
bJQueryUI: true,
sScrollY: "465px",
sScrollX: "100%",
sServerMethod: 'POST',
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": "getClients",
"data": aoData,
"success": fnCallback
} );
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$('td:eq(5)', nRow).html( '<div style="text-align:right;padding:5px 40px 5px 5px;"><a class="cusmedit" data-cli-id="' + aData[0] + '" href="#"><img src="../../images/16x16_gear.png" alt="Edit" title="Edit Client" /></a>   <a class="cusmdeactivate" data-cli-id="' + aData[0] + '" href="#"><img src="../../images/16x16_delete.png" alt="Deactivate" title="Deactivate Client" /></a></div>' );
return nRow;
},
"fnDrawCallback": function (oSettings) {
$('.cusmedit').unbind();
$('.cusmedit').bind('click', function () {
$.ajax({
url: 'getClientDetails',
dataType: 'json',
type: 'POST',
data: {
idclient:$(this).data('cli-id')
},
success: function(j) {
loadClientDetails(j);
}
});
});
$('.climdeactivate').unbind();
$('.climdeactivate').bind('click', function () {
alert('deactivate clicked '+ $(this).data('cli-id'));
});
}
});
And here is where we get the data from "getClients":
``` $this->load->helper("Datatables");
$idaccount = $this->session->userdata('idaccount');
$table = 'client';
$this->datatables->select('idclient, clientname, dottype, idparent, contact, contactphone');
$this->datatables->where('idaccount', $idaccount);
$this->datatables->from('client');
$this->datatables->add_column('actions', 'html');
$this->datatables->edit_column('dottype', '$1', 'getDOTType(dottype)');
$this->datatables->edit_column('idparent', '$1', 'getClientParent('.$idaccount.', idparent)');
echo $this->datatables->generate();```
Datatables debugger: idizek