FilamentF
Filament3y ago
mxc

Select component with searchable & live?

Hi all,

I have a select box populated via a query that has the live method enabled as there is a dependent select whose options change depending on what is selected in the parent. If I enable searchable on the parent select the functionality doesn't work. A red box is placed around the parent select. The dependent select is not updated. It works fine if searchable is not enabled. I have tried adding debounce(600) as I have seen suggested by it doesn;t change the outcome.

                Section::make()->schema([
                    Select::make('Customer')->options(Models\Customer::all()->pluck('CompanyName', 'ID')
                        ->sort(function ($customer1, $customer2) {
                            return strtolower($customer1) <=> strtolower($customer2);
                        }))->label('Customer')
                        ->live(),
                    //->searchable(),
                    // })->reactive(),
                    //->debounce(600),
                    Select::make('Contact')
                        ->options(function (Get $get): Collection {
                            $customer_id = $get("Customer");
                            $results = Models\CustomerContact::where('CustomerId', $customer_id)->pluck('Name', 'CustomerContactID')
                                ->sort(function ($customer1, $customer2) {
                                    return strtolower($customer1) <=> strtolower($customer2);
                                });
                            return $results;
                        })
                        ->label('Contact')
                        ->searchable(),
Was this page helpful?