EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

EA Dropdowns are not populated until you click in them

Open bytes-max opened this issue 3 years ago • 4 comments

Describe the bug I am observing that for example Country Fields do not get populated without further user interaction, which makes it hard to add events on specific clicks.

This is how the HTML looks like for a CountryField upon loading:

image

But, once you click it, the JS will transform the Select List into a proper HTML list. Then, it looks like this: image

I weren't able to find the proper JS for it, but instead of this behavior, the code should either a) pre-populate the list automatically upon rendering b) fire an specific event in case of clicking, so that developers have it easier to hook into it (i.e. to set events to the individual targets)

If somebody can provide me with an Entry point for this I might be able to do it myself, too.

bytes-max avatar Nov 07 '23 15:11 bytes-max

We use a third-party library called "Tom Select" to manage dropdowns. They provide many events, so maybe you can use any of them. See https://tom-select.js.org/docs/events/

javiereguiluz avatar Nov 08 '23 16:11 javiereguiluz

Perfect, I will give it a look, thank you very much @javiereguiluz :heart:

bytes-max avatar Nov 08 '23 21:11 bytes-max

@javiereguiluz Where can I find documentation on how Tom Select can be called in Symfony FormBuilder? I'm trying to essentially real time update the value of one field based on the contents of another.

Ctucker9233 avatar Nov 19 '23 00:11 Ctucker9233

So I figured out that only two (of the fews I've tested) events are fired, and opened this bug report: https://github.com/orchidjs/tom-select/issues/659

@Ctucker9233 I think you would ask that rather on StackOverflow.

bytes-max avatar Nov 19 '23 10:11 bytes-max