We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
master
Execute code:
<?php use kartik\select2\Select2; use yii\web\View; echo Select2::widget([ 'name' => 'colors', 'data' => ['red' => 'Red', 'green' => 'Green', 'blue' => 'Blue'], 'hashVarLoadPosition' => View::POS_READY, 'options' => [ 'placeholder' => 'Select colors ...', 'multiple' => true, ], ]);
Click on Select2 input to open it.
When I follow those steps, I don't see "Select All" or "Unselect All" buttons when Select2 opened.
I was expecting to see "Select All" or "Unselect All" buttons when Select2 opened.
Browsers
Operating System
Libraries
The problem is 'hashVarLoadPosition' => View::POS_READY and this change 6a6840c#diff-2891a29e6f4f80976e580d1b4c555a1ad7283461a1ca565cae435633bfe4f6bcL435-R440 (which is correct I guess, because it fixes issue #325). If 'hashVarLoadPosition' => View::POS_HEAD (by default) then code
'hashVarLoadPosition' => View::POS_READY
'hashVarLoadPosition' => View::POS_HEAD
yii2-widget-select2/src/Select2.php
Line 460 in 2346248
registers variable in the global namespace and it is available in
yii2-widget-select2/src/assets/js/select2-krajee.js
Line 136 in 2346248
but if 'hashVarLoadPosition' => View::POS_READY then the same code registers variable as local, enclosed by
jQuery(function ($) { // some code });
and aforementioned
var opts = window[optVar] || {}, // other code
always silently results in empty object. I think that
$view->registerJs("var {$this->_s2OptionsVar} = {$options};", $this->hashVarLoadPosition);
can be safely replaced on
$view->registerJs("window.{$this->_s2OptionsVar} = {$options};", $this->hashVarLoadPosition);
I'll prepare PR soon.
The text was updated successfully, but these errors were encountered:
Fix kartik-v#350: "Select All" / "Unselect All" not shown when proper…
a944bbd
…ty hashVarLoadPosition is View::POS_READY (some options does not pass from PHP to JS)
d5a4be0
Merge pull request #351 from dmitry-kulikov/fix/passing_options_to_js
e74b41c
Fix #350: "Select All" / "Unselect All" not shown when property hashVarLoadPosition is View::POS_READY (some options does not pass from PHP to JS)
No branches or pull requests
Prerequisites
master
branch of yii2-widget-select2.Steps to reproduce the issue
Execute code:
Click on Select2 input to open it.
Expected behavior and actual behavior
When I follow those steps, I don't see "Select All" or "Unselect All" buttons when Select2 opened.
I was expecting to see "Select All" or "Unselect All" buttons when Select2 opened.
Environment
Browsers
Operating System
Libraries
Isolating the problem
The problem is
'hashVarLoadPosition' => View::POS_READY
and this change 6a6840c#diff-2891a29e6f4f80976e580d1b4c555a1ad7283461a1ca565cae435633bfe4f6bcL435-R440(which is correct I guess, because it fixes issue #325).
If
'hashVarLoadPosition' => View::POS_HEAD
(by default) then codeyii2-widget-select2/src/Select2.php
Line 460 in 2346248
registers variable in the global namespace and it is available in
yii2-widget-select2/src/assets/js/select2-krajee.js
Line 136 in 2346248
but if
'hashVarLoadPosition' => View::POS_READY
then the same code registers variable as local, enclosed byand aforementioned
always silently results in empty object.
I think that
can be safely replaced on
I'll prepare PR soon.
The text was updated successfully, but these errors were encountered: