I use EasyAdmin 3.5 on a Symfony 5.3.16 project.
I developed a custom easyAdmin page with a symfony form that uses select field.
These fields are emptied and re-filled with some ajax calls from a first select field.
I wanted to add a autocomplete feature on these field. In order to do that, I added this attribute on my formType :
->add('customer', EntityType::class, [
'class' => Customer::class,
'label' => 'OU Client',
'required' => false,
'placeholder' => 'Sélectionnez un client',
'attr' => [
'data-ea-widget' => 'ea-autocomplete',
],
The autocomplete attr works very well, but when I made my ajax calls to update options of my select field, My autocomplete does not perform update.
I don't know how to tell my ea-autocomplete attributed field to trigger changes after my ajax call ? What is the javascript command I should use to do so ?
Thanks for your help !
maybe too late but it could help others.
EasyAdmin autocomplete use TomSelect, if you want to edit(add/select/remove) you need to do
document.getElementById(your_id).tomselectand use TomSelect apis to do what you want.