select2entity-bundle用ajax发送第二个参数

时间:2016-10-29 11:33:29

标签: ajax symfony select2

我正在使用tetranz/select2entity-bundle,我想通过ajax发送另一个参数,以便在查询中使用它。

$builder->add('client', Select2EntityType::class, array(
                'multiple' => false,
                'remote_route' => 'clientquery',
                'class' => 'ProjetsBundle\Entity\Client',
                'primary_key' => 'id',
                'placeholder' => 'Sélectionnez un client',
                'language' => 'fr',
                'page_limit' => 50,
            ))

这可能吗?

1 个答案:

答案 0 :(得分:0)

是的,可以使用'remote_params'选项

进行圆顶化
 $builder->add('client', Select2EntityType::class, array(
                'multiple' => false,
                'remote_route' => 'clientquery',
                'class' => 'ProjetsBundle\Entity\Client',
                'primary_key' => 'id',
                'placeholder' => 'Sélectionnez un client',
                'language' => 'fr',
                'page_limit' => 50,
                'remote_params' => array('secondparameter'=>'value',
                                 'thirdparameter'=>'value')

            ))
相关问题