我正在使用kartik select2库。我有一个模式,从ajax与renderAjax加载页面。模态有select2下拉列表。
问题是它加载了js但是没有加载select2的css文件。
echo $form->field($assign_model, 'applicant_id')->widget(Select2::classname(), [
'data' => $applicant,
'attribute' => 'applicant_id',
'options' => ['placeholder' => 'Select an applicant', 'multiple' => 'multiple', 'style' => "width:100%"],
'pluginEvents' => [
"select2:selecting" => "function() { "
. "no_position = $('body').data('no_position');"
. "if(no_position>= " . $model->no_of_persons . "){alert('You can select only " . $model->no_of_persons . " applicant(s)');return false;} }",
"select2:select" => "function() { "
. "no_position = $('body').data('no_position');"
. "$('body').data('no_position',++no_position);}",
"select2:unselect" => "function() { "
. "no_position = $('body').data('no_position');"
. "$('body').data('no_position',--no_position);}",
],
'pluginOptions' => [
'allowClear' => true,
]
]);