Hi to all,
Following this link /topic/72-categories-and-subcategories/ I made some changes and fit the code to use in my project, but I need to use this issue not with dropdown lists, but with multiselect.
The problem I'm facing is that my multiselect doesn't update the list. With firebug I got no errors and the ajax return it's ok bringing the correct value, but when I click on the multiselect it shows the whole list.
I also found this link /topic/1730-triggerlisztupdated-not-working-on-multi-select/ but didn't help me.
In my code my multiselect field is the CODREG. With other dropdown fields like CODLOC or CODJOR work fine.
Could someone help me undertand where's the problem?
Controller:
... $crud->display_as('CODREG','Regionais'); $regionais = $this->main_model->buscar_descricao_regionais(); foreach ($regionais->result() as $reg){ $array_regionais[$reg->CODREG] = $reg->DESREG; } $crud->field_type('CODREG','multiselect', $array_regionais); ... $output = $crud->render(); $dd_data = array( 'dd_state' => $crud->getState(), 'dd_dropdowns' => array('CODPER','CODLOC','CODREG','CODJOR'), 'dd_url' => array('', site_url().'main/carregar_locais_preparacao/',site_url().'main/carregar_regionais_preparacao/',site_url().'main/carregar_jornadas_preparacao/'), 'dd_ajax_loader' => base_url().'ajax-loader.gif' ); $output->dropdown_setup = $dd_data; $this->template($output); ... function carregar_regionais_preparacao() { $periodo = $this->uri->segment(3); $db = $this->main_model->carregar_regionais_por_periodo($periodo); $array = array(); foreach($db->result() as $row): $array[] = array("value" => $row->CODREG, "property" => $row->DESREG); endforeach; echo json_encode($array); exit; }
Model:
function carregar_regionais_por_periodo($periodo) { return $this->db->query('select CODREG, DESREG from e015reg where e015reg.CODREG =1'); }
Thanks to all.