Closed IGaMbLeRI closed 5 years ago
I have the same problem, hope someone is gonna find a solution.. please UP!
You need to escape the JS functions via yii\web\JsExpression
when setting key values within PHP arrays - so that they are encoded properly:
Example:
'pluginOptions' => [
'escapeMarkup' => new yii\web\JsExpression('function (markup){return markup}')
]
thanks a lot!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Prerequisites
master
branch of yii2-widget-select2.Steps to reproduce the issue
language
property to anarray
causes an error. Respectfully so, according to the documentation the widget will accept only astring
.the following option was also advised in https://github.com/select2/select2/issues/3576 :
Expected behavior and actual behavior
When I follow those steps, I see:
Although the inserted JS did not trigger besides being correctly attached at the bottom of the page, running the JS from Console produced one aspect of the expected result.
As it turns out, running the JS will effectively reset the existing Select2 along with all data and styles, but it will also change the text of the
noResults
! This is an expected behaviour for the Select2 plugin, but the plugin also allows to set these variables during initialization so you don't have to change them on the go.I was expecting:
Frankly, I was expecting the Widget to accept
array
aslanguage
, so I could in some way pass the customnoResults
content, such as a button to add the Input to the Dropdown list and select that value. All that without having to recreate the widget in JS.Environment
Browsers
Operating System
Libraries
Isolating the problem