What seems to be the problem:
I’m using select2 for multiselect options. How to update multipleselect from Livewire PHP component based on an other input change while it using wire:ignore. As we know we use wire:ignore to allow select2 to work.
Now If I remove wire:ignore it starts working but select2 styles gone. What could be a possible solution?
Component code
class CreateTeam extends Component
{
public $gameName;
public function render()
{
$favGames = \App\FavGames::where('game_id' , $this->gameName)->get();
return view('livewire.player.create-team' , compact('games' , 'favGames'));
}
}
Component blade
<div>
@foreach($games as $game)
@if(\App\FavGames::select('id')->where('user_id',Auth::id())->where('game_id' , $game->id)->exists())
{{ $game->name }}
@endif
@endforeach
<div wire:ignore>
<select name="invitemembers[]" id="invitemembers" multiple="multiple" required>
@if (isset($favGames))
@foreach ($favGames as $favGame)
<option>{{ $favGame->name }}</option>
@endforeach
@endif
</select>
</div>
</div>