Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select is not displaying the selected item properly #612

Open
muhammadessam opened this issue Feb 6, 2023 · 2 comments
Open

select is not displaying the selected item properly #612

muhammadessam opened this issue Feb 6, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@muhammadessam
Copy link

The select is not showing which item is selected with the right mark over the left of the selected item:

               <x-select class="my-1" 
                          label="Search Specialization"
                          wire:model.defer="user.specialization_id"
                          placeholder="{{trans('Select Specialization')}}"
                          option-value="id"
                          :searchable="true"
                          :min-items-for-search="1"
                          option-label="title"
                          :options="\App\Models\Specialization::main()->get()">
                </x-select>
                <x-select label="Search Specialization"
                          :searchable="true"
                          :min-items-for-search="1"
                          wire:model.defer="role_id"
                          placeholder="{{trans('Select Role')}}" option-value="id"
                          option-label="name" :options="\Spatie\Permission\Models\Role::all()">
                </x-select>

the selected item doesn't show up as selected
image

@1andy11
Copy link

1andy11 commented Jul 11, 2023

I have the same problem and found out that there is wrong order of calling functions in init function.
Function initOptionsObserver is calling before initWireModel. this.selected is initialized in initWireModel but is used in syncSelectedOptions which is called from initOptionsObserver so this.selected is not initialized yet.

@henk-hypershop
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants