kartik-v / yii2-widget-select2

Enhanced Yii2 wrapper for the Select2 jQuery plugin (sub repo split from yii2-widgets).
http://demos.krajee.com/widget-details/select2
Other
323 stars 145 forks source link

Some options, like widget size, does not applied if widget loaded via AJAX #325

Closed abolotin closed 4 years ago

abolotin commented 4 years ago

Hello :)

When widget loaded via AJAX, it's useful to use hashVarLoadPosition=View::POS_READY But some options (size, for example) are still at head of page, which does not rendered in AJAX mode.

src\Select2.php, function registerAssets():

$view->registerJs("var {$this->_s2OptionsVar} = {$options};", View::POS_HEAD);

should be replaced by:

$view->registerJs("var {$this->_s2OptionsVar} = {$options};", $this->hashVarLoadPosition);

?