nova-ajax-select icon indicating copy to clipboard operation
nova-ajax-select copied to clipboard

3 or more dependend selects > not resetting correctly

Open preliot opened this issue 6 years ago • 3 comments

I've got multiple selects depending on eachother. Simplified example:

client location department user

User depends on department, department on location and location on client.

Bug

  1. Select a (dependend) value in each select
  2. Change the selected option in client (first select)
  3. Location is properly resetted and department disabled.
  4. User however still has the old values

preliot avatar May 16 '19 14:05 preliot

code?

dillingham avatar May 16 '19 15:05 dillingham

\Laravel\Nova\Fields\BelongsTo::make('Distributor', 'distributor', DistributorResource::class)
                ->rules('required');

\NovaAjaxSelect\AjaxSelect::make('Client', 'client_id')
                    ->get(config('nova.path') . "/orglevel/distributors/{distributor}/clients")
                    ->parent('distributor');


\NovaAjaxSelect\AjaxSelect::make('Location', 'location_id')
                    ->get(config('nova.path') . "/orglevel/clients/{client_id}/locations")
                    ->parent('client_id');


\NovaAjaxSelect\AjaxSelect::make('Department', 'department_id')
                    ->get(config('nova.path') . "/orglevel/locations/{location_id}/departments")
                    ->parent('location_id');

\NovaAjaxSelect\AjaxSelect::make('User', 'user_id')
                    ->get(config('nova.path') . "/orglevel/departments/{department_id}/users")
                    ->parent('department_id');

Updated the code and changed the formatting. When i select all values and reset:

  1. Distributor -> client is resetted and location disabled. Department and User are not changed.
  2. Client -> location is resetted and department disabled. User is not changed.

preliot avatar May 16 '19 15:05 preliot

@dillingham If you have the time, can you confirm that this is a legit bug? Or if it's not?

preliot avatar May 30 '19 08:05 preliot