Ignited+datatables -> order by

use:

$this->db->order_by("column name", "desc");

You can use the aaSorting parameter to order the table on initialization.

$(document).ready( function() {
  $('#example').dataTable( {
    "aaSorting": [[2,'asc'], [3,'desc']]
  } );
} );

where 2 and 3 are column's index


You can use this way i am controlling here all required value with codeigniter DATA-TABLE and MYSQL select include a small joining

function get_ComponentList($rowperpage, $row, $search='',$order, $dir)
{ 
$this->db->select('a.component_id, a.component_name as component_name, a.eco_code as eco_code, b.component_name as parent_name');
    $this->db->from('component_info as a');
    $this->db->join('component_info as b', 'b.component_id = a.parent_id', 'left');
    $this->db->order_by($order,$dir);
            if($search != ''){
            $this->db->like('a.component_name', $search);
            $this->db->or_like('a.eco_code', $search);
            $this->db->or_like('b.component_name', $search);
            }    
            $this->db->limit($rowperpage,$row);
           $query = $query->result(); 
    return $query;}