By making a callback to a dropdown loses the style (if the first dropdown the form, if not so it's okay)
I put the code here:
$crud->callback_field ( 'id_provincia', array ( $this, '_callback_field_provincia' ) );
// Ayudante de funciones de Filtrar DropDowns según el usuario logeado
function filter_dropdown($table, $id_table, $desc_table, $id_field)
{
$this->db->select ( '*' );
$this->db->from ( $table );
$this->db->where ( $id_table, $id_field );
$result = $this->db->get ();
$data = $result->row ();
$html = '<div><select name="'.$id_table.'" class="chosen-select" data-placeholder="Selecciona '.ucwords($table).'" style="width: 200px;">';
$html.= '<option value=""></option>';
$html.= '<option value="'.$data->$id_table.'" >'.$data->$desc_table.'</option>';
$html.= '</select></div>';
return $html;
// retorna el selectbox filtrado
}
// Filtrar DropDowns según el usuario logeado
function _callback_field_provincia($value = '', $primary_key = null)
{
return $this->filter_dropdown('provincia','id_provincia','desc_provincia',$this->session->userdata('provincia'));
}
before callback:

after callback:

Note: I'm using this library gc_dependent_select
