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

Select2 does not allow you to enter text into the input if set to multiple => false But all OK if multiple => true #359

Open
muramidaza opened this issue Aug 2, 2023 · 0 comments

Comments

@muramidaza
Copy link

muramidaza commented Aug 2, 2023

Hello! I need to set to page on PHP/HTML Select2 widget. If I set 'multiple' => false in the configuration, then in the displayed Select2 cannot enter text and search (not set focus on input). If I put 'multiple' => true, then everything works fine.

$html .= Select2::widget([
            'name' => 'select_patterns_' . $model->id,
            'options' => [
                'class' => 'form-control',
                'placeholder' => 'Шаблон',
                'multiple' => false
            ],
            'hideSearch' => true,
            'pluginOptions' => [
                'minimumInputLength' => 3,
                'ajax'=>[
                    'url'=> Url::to(['persons/get-user']),
                    'dataType' => 'json',
                    'delay' => 250,
                    'cache' => true,
                ],
                'allowClear' => true,
            ],
            'pluginEvents' => [
                'change' => 'function() {
                        var selectedIds = $(this).val();
                        console.log(selectedIds);
                    }'
                ]
            ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant