Livewire with a <select>

Hi,

I have a simple lirewire compenent link to a select:

select wire:model=“set_id” class=“mt-1 col-md-4 form-control” name=“periode” id=“periode”
@foreach($periodes as $periode)
option value="{{$periode->id}}" {{$periode->name()}}/option
@endforeach
/select

public $set_id = 1;

public function render()
{
    $periodes = Periode::all();
    $payes = Paye::where("periode_id", intval($this->set_id))->get();
    return view('livewire.payes', ['payes'=>$payes, 'periodes'=>$periodes]);
}

Everything work on first draw. The default value is set.

But after inital draw if i change the select value the component is not re-draw with new data. I try to dump($this->set_id) and the value is good so the wire:model seem to work.

Any idea?

I found the refresh problem was due to multiple root element… I guess this is a beginner error :slight_smile:

1 Like

That’s normal.
Keep going on.