Pharaonic / livewire-select2

Simple way to handle the Select2 for livewire components.
https://pharaonic.io/packages/livewire/select2
MIT License
37 stars 11 forks source link

Remove Selected Item #5

Closed masadi closed 1 year ago

masadi commented 1 year ago

How to remove selected item after data saved?

MoamenEltouny commented 1 year ago

can you explain your issue please?

masadi commented 1 year ago

Like this https://select2.org/programmatic-control/add-select-clear-items

Selected $('#mySelect2').val('1'); // Select the option with a value of '1' $('#mySelect2').trigger('change'); // Notify any JS components that the value changed

Remove selected $('#mySelect2').val(''); // Select the option with a value of null $('#mySelect2').trigger('change'); // Notify any JS components that the value changed

MoamenEltouny commented 1 year ago

@masadi i think its good idea if we add new events that can called from livewire component to manipulate the options of select. i will work on that soon