You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
There are two similar closed issues: 306 and 312. But the issue still exists.
The issue still exists against the latest master branch of yii2-widget-select2. (version 2.1.9)
When press 'Select all' - expecting behavior - select all options.
If some options' values have minus '-', 'Select All' doesn't select them. In the following example only 'One' and 'Two' will be selected. Even so, 'Three' and 'Four' can be selected manually one by one.
Now everything works fine for the case without active-form and model.
But if we use active-form and model - Select All stops working, because regex doesn't match any id. It's because with active form and model is formed like select2-modelName-fieldName-result-randomValue-id
Maybe regex should be changed to something like this ^select2-\S*-result-.{4}-(.*)$
Prerequisites
I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
There are two similar closed issues: 306 and 312. But the issue still exists.
The issue still exists against the latest
master
branch of yii2-widget-select2. (version 2.1.9)This is not an usage question. I confirm having read the widget documentation and demos.
This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
This is not a source plugin (select2) issue. (Those should be directed to the plugin issues repo).
I have attempted to find the simplest possible steps to reproduce the issue.
I have included a failing test as a pull request (Optional).
Steps to reproduce the issue
echo Select2::widget([ 'name' => 'state_10', 'data' => [ 'first'=>'One', 'second' => 'Two', 'thi-rd' => 'Three', 'fourth-' => 'Four'], 'options' => [ 'placeholder' => 'Select provinces ...', 'multiple' => true ], ]);
Expected behavior and actual behavior
When press 'Select all' - expecting behavior - select all options.
If some options' values have minus '-', 'Select All' doesn't select them. In the following example only 'One' and 'Two' will be selected. Even so, 'Three' and 'Four' can be selected manually one by one.
Environment
Browsers
Operating System
Libraries
Isolating the problem
Workaround
Maybe this can help to resolve the issue - change 46 row of 'select2-krajee.js':
from
val = $(this).attr('id').split('-').pop();
to
[, val] = $(this).attr('id').match(/^select2-[^-]*-result-.{4}-(.*)$/);
The text was updated successfully, but these errors were encountered: