ShtumiUsefulBundle
ShtumiUsefulBundle copied to clipboard
Select control duplicate
I'm use this bundle is excellent but i have a error, when load its in select dependent, where mi parent is Category and my chind control is Product, it's work perfect but have a bug, on duplicate control product
this is my code config
shtumi_useful:
dependent_filtered_entities:
producto_by_categoria:
class: GestionBundle:Producto
parent_property: categoria
property: nombreciud
role: IS_AUTHENTICATED_ANONYMOUSLY
no_result_msg: 'No hay regiones encontradas'
order_property: nombreciud
order_direction: ASC`
this is mi code from my admin class selecction where implement this functionality
$formMapper
->add('codigo','text', array('label'=>'codigo', 'required'=>'true'))
->add('categoria')
->add('productos')
->add('productos', 'shtumi_dependent_filtered_entity', array(
'entity_alias' => 'producto_by_categoria',
'empty_value' => 'Select',
'parent_field' => 'categoria',
'required' => true,
))
;

help me pease!
Hi @duvg the problem isn't this bundle, the problem is the select2 library used by Sonata.
My solution was make a call to setup_select2() function after the ajax call.
$(document).ajaxSuccess(function (event, xhr, settings) {
Admin.setup_select2();
});