victorybiz / laravel-simple-select

Laravel Simple Select inputs component for Blade and Livewire.
MIT License
125 stars 18 forks source link

Module not workin in modal #23

Open MohammaddReza opened 9 months ago

MohammaddReza commented 9 months ago

I'm using wire-elements/modal module simple-select works very well outside of this module but it doesn't work in the module

sfc3lf44 commented 8 months ago

I have a similiar issue, although I'm not use wire-elements. If the simple-select is inside a child livewire component the population of options is not always working correctly. However, if I keep a second instance of simple-select on the parent page, the functionality seems to work more consistently.
When it's not working correctly inside a livewire child component, I am able to output the options variable and see the values. So I know it is getting passed correctly from the livewire component. But the id/name value pairs aren't shown in the select box. It is empty. I suspect something is not getting initialized properly that is causing this behavior.

ronald2wing commented 7 months ago

I have the same issue.

NikarashiHatsu commented 3 months ago

I had the similar issue, not only with this package, but also livewire-mapbox as well. I guess there's some code within the Wire-element's Modal that causes the component not being initiated properly. I haven't found the exact cause, but I'd love to see if you guys having workarounds after those times.

NikarashiHatsu commented 2 months ago

Hi, I hope this issue is still relevant and can help you guys. I found a workaround that works pretty well, but you have to:

  1. Publish the Wire Elements' vendor files.
  2. Publish the Simple Select's vendor files (although this is optional, but I recommend to do so since I made a lot of adjustments here).

Then, edit the resources/views/vendor/wire-elements-modal/modal.blade.php, add the @include('simple-select::components.script') just inside the <div> where it has the x-data="LivewireUIModal()" attribute.

Screenshot 2024-07-27 at 22 51 25

Enjoy your working component, and happy coding.

Screenshot 2024-07-27 at 22 54 42