Skip to content

Conversation

Deksor
Copy link

@Deksor Deksor commented Jul 28, 2025

Hello !
I am making this PR because I need to be able to customize autocomplete fields in my project to improve performance and fine tune some specific features of my website.

In symfony-ux autocomplete, it is very easy thanks to a couple of events dispatched right before and right after the autocomplete fields have been created : https://symfony.com/bundles/ux-autocomplete/current/index.html#extending-tom-select.

So I took inspiration from this part of symfony-ux autocomplete's code:
https://github.com/symfony/ux-autocomplete/blob/2.x/assets/src/controller.ts

I am aware that someone has suggested to use symfony-ux in easyadmin :
#6967

But for the time being (whether ea moves to symfony-ux or not) is it possible to dispatch these events every time an Autocomplete object is created by EasyAdmin's frontend ?

This would simplify greatly the process of customizing autocomplete fields in easyadmin !

Instead of manually grabbing the select element by its id and finding tomselect in that select, it would become as simple as

document.addEventListener('ea.autocomplete.connect', (event) => {
    // custom code goes here
});

@Deksor Deksor changed the title added symfony-ux inspired events for autocomplete Symfony-ux inspired events for autocomplete Jul 28, 2025
@Seb33300
Copy link
Contributor

Seb33300 commented Aug 2, 2025

Wouldn't it be better to replace EasyAdmin's implementation of Tom Select with Symfony UX Autocomplete?

@Deksor
Copy link
Author

Deksor commented Aug 3, 2025

Oh absolutely having Symfony UX autocomplete in easy admin would be awesome !
I was just suggesting this because it would be faster to implement this 10 lines fix than switching ea to Symfony UX autocomplete.
But if it is planned to move easyadmin to Symfony UX autocomplete (and turbo, please 👍 ) it would be better.

@javiereguiluz javiereguiluz added this to the 4.x milestone Sep 2, 2025
@javiereguiluz
Copy link
Collaborator

Using UX autocomplete is a long-term goal (for EasyAdmin 5.x version) so, let's merge this now to provide at least something for those needing this.

Thanks @Deksor!

@javiereguiluz javiereguiluz merged commit c0a9301 into EasyCorp:4.x Sep 2, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants