Answer the question
In order to leave comments, you need to log in
Why is the selected value not showing in Select2?
Hello. I have the following code using kartik\select2:
$user_profiles = ArrayHelper::merge(['' => 'Выберите пользователя'],
ArrayHelper::map(Profile::find()->orderBy('full_name')->asArray()->all(), 'user_id',
'full_name'))
\kartik\widgets\Select2::widget([
'name' => 'state_10',
'data' => $user_profiles,
'size' => \kartik\select2\Select2::SIZE_LARGE,
'pluginEvents' => [
"change" => 'function() {
var data_id = $(this).val();
document.getElementById(\'userId\').value = data_id
}',
],
'pluginOptions' => [
'tags' => true
]
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question