Para crear un elemento autocompletable usando jQuery IU y CodeIgniter se debe tener presente lo siguiente:
$this->db->select('id');
$this->db->select("CONCAT(trabajadores.nombres,' ',trabajadores.apellidos) as value",FALSE);
$this->db->from('trabajadores');
$this->db->where("(nombres LIKE '%".$this->db->escape_like_str($q)."%' or
apellidos LIKE '%".$this->db->escape_like_str($q)."%' or
CONCAT(`nombres`,' ',`apellidos`) LIKE '%".$this->db->escape_like_str($q)."%') and eliminado=0");
$this->db->order_by("nombres", "asc");
$this->db->limit(10);
$query = $this->db->get();
if($query->num_rows() > 0 ){
foreach($query->result() as $row)
{
$listado[]= $row;
}
return $listado;
}
return FALSE;