I'am trying to display same data using datatables server side processing at Codeigniter.I should use 'where' clause and i'am using Emran ul hadi script class.(Visit https://emranulhadi.wordpress.com/2014/06/05/join-and-extra-condition-support-at-datatables-library-ssp-class/#comment-196). My controller script :
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'kreatx',
'host' => 'localhost'
);
$index = $this->uri->segment(3);
$table = 'user';
$columns = array(
array('db' => 'Name', 'dt' => 0),
array('db' => 'Lastname', 'dt' => 1),
array('db' => 'Email', 'dt' => 2),
array('db' => 'Username', 'dt' => 3),
array('db' => 'Password', 'dt' => 4)
);
$primaryKey = 'ID';
$this->load->model('employees_model');
$department = $this->employees_model->get_department($index);
require( 'SSP.php' );
$where = 'Department = '.$index.'';
echo json_encode(
SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns,
null ,$where )
);
My view script :
$('#employees').DataTable({
"responsive":true,
"processing":true,
"serverSide":true,
"searching":true,
"ordering":true,
"order":[],
"ajax":{
url:"<?php echo base_url() .
'employees/get_employees/'.$index.''; ?>",
type:"POST"
},
"columnDefs":[
{
"targets":[4],
"orderable":false,
},
],
});
Table is displaying correctly,with no errors.But search and order does'nt work. If i try to search it just say prrocessing and show the same table. Same problem with ordering. Any sugesstion please ? Thanks !