Searchable Not Working When Preload is Set For Select Field With relationship
I have this code
Forms\Components\Select::make('product_id') ->label('Product') ->required() ->preload() ->searchable() ->relationship('product', 'title') ->prefixIcon(IconEnum::PRODUCT->value) ->placeholder('Select a product') ->helperText('Product this promo code applies to'),
Forms\Components\Select::make('product_id') ->label('Product') ->required() ->preload() ->searchable() ->relationship('product', 'title') ->prefixIcon(IconEnum::PRODUCT->value) ->placeholder('Select a product') ->helperText('Product this promo code applies to'),
when the preload is set the searchable will not work because of this code in filament select field
public function hasDynamicSearchResults(): bool{ if ($this->hasRelationship() && empty($this->searchColumns)) { return ! $this->isPreloaded(); } return $this->getSearchResultsUsing instanceof Closure;}
public function hasDynamicSearchResults(): bool{ if ($this->hasRelationship() && empty($this->searchColumns)) { return ! $this->isPreloaded(); } return $this->getSearchResultsUsing instanceof Closure;}
above code will block the code of
$this->getSearchResultsUsing
$this->getSearchResultsUsing
which defined in the
relationship
relationship
method. My question is why is that? In my use cases I want to preload the data at first with some limit and allow user to search for the rest of the data.