koss-shtukert / laravel-nova-select2-auto-complete

Laravel Nova Select2 Auto-Complete
https://novapackages.com/packages/koss-shtukert/laravel-nova-select2-auto-complete
MIT License
38 stars 11 forks source link

Read Only doesn't seem to work #17

Closed mattcdavis1 closed 5 years ago

mattcdavis1 commented 5 years ago

Not sure if i'm doing something wrong but the below code does not render a readonly field.

Select2::make('Group', 'group_id')
    ->sortable()
    ->options($groups)
    ->readonly(true)
    ->configuration([
        'placeholder' => 'Select a Group',
        'minimumResultsForSearch' => 1,
    ]),
koss-shtukert commented 5 years ago

Hi @mattcdavis1, in the latest version I'm fix it. Now you can use readonly method or configuration(['disabled' => true]) like alias


Select2::make('Some ID', 'id')
                ->sortable()
                ->readonly()

or

Select2::make('Some ID', 'id')
                ->sortable()
                ->configuration([
                    'placeholder'             => __('Choose an option'),
                    'allowClear'              => true,
                    'minimumResultsForSearch' => 1,
                    'disabled'                => true,
                ])
mattcdavis1 commented 5 years ago

great - thanks!