filament
filament copied to clipboard
Refactor select component to use array of objects for optionsRefactor…
Addressing the issue of non-sortable select options.
Should work for ->options()->searchable()
and ->relationship()->searchable()
.
The only limitation is ->options()->searchable()
when searching, as these results are ordered client side via FuseJS.
Forms\Components\Select::make('test')
->searchable()
->options([
3 => 'First entry',
1 => 'Second entry',
2 => 'Third entry',
]),
Forms\Components\Select::make('blog_author_id')
->relationship('author', 'name', fn ($query) => $query->orderByDesc('id'))
->getOptionLabelFromRecordUsing(fn ($record) => $record->name . ' (' . $record->id . ')')
->searchable()
Fixes #3268
I am assuming this would be needed for MultiSelect as well?
I am assuming this would be needed for MultiSelect as well?
MultiSelect instanceof Select === true
@pxlrbt, what's required for this PR to move forward? 😊
@zepfietje This is only waiting on a thorough review and some feedback from @danharrin. I only set it on "draft" so it's not merged "too quickly" 😅
@pxlrbt could you resolve merge conflicts?
I've just fixed the merge conflicts @pxlrbt, could you double check it all still works as intended before I give it a review?
Sorry, didn't have the time this week and will be on vacation the next two weeks.