multiselect creates groups after selecting first item

I'm using the table builder in a Livewire component. I have a multi select that searches using a custom function. On the first search it works fine (picture 1), but after i select a record, all of a sudden all my options are in groups. (picture 2) This is my select field:
Select::make('city')
->live()
->multiple()
->getSearchResultsUsing(function (string $search) {
return $this->updatedCitySearch($search);
})
->getOptionLabelUsing(fn ($value): ?string => $value),
Select::make('city')
->live()
->multiple()
->getSearchResultsUsing(function (string $search) {
return $this->updatedCitySearch($search);
})
->getOptionLabelUsing(fn ($value): ?string => $value),
My custom search returns an array like this:
[
['Schoonhoven' => 'Schoonhoven'],
['Schoonloo' => 'Schoonloo'],
...
]
[
['Schoonhoven' => 'Schoonhoven'],
['Schoonloo' => 'Schoonloo'],
...
]
How do i prevent my records from going in to groups?
No description
No description
1 Reply
Remi Hindriks
Remi HindriksOP5mo ago
For future searchers: My issue was my array:
[
['Schoonhoven' => 'Schoonhoven'],
['Schoonloo' => 'Schoonloo'],
...
]
[
['Schoonhoven' => 'Schoonhoven'],
['Schoonloo' => 'Schoonloo'],
...
]
It shouldnt be multi level, the correct array was:
[
'Schoonhoven' => 'Schoonhoven',
'Schoonloo' => 'Schoonloo',
...
]
[
'Schoonhoven' => 'Schoonhoven',
'Schoonloo' => 'Schoonloo',
...
]
Want results from more Discord servers?
Add your server