Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select control duplicate #67

Open
duvg opened this issue Feb 4, 2016 · 1 comment
Open

Select control duplicate #67

duvg opened this issue Feb 4, 2016 · 1 comment

Comments

@duvg
Copy link

duvg commented Feb 4, 2016

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,

            ))
        ;

bug

help me pease!

@anacona16
Copy link

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();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants