yii2 select2资产包从ajax调用时不加载css

时间:2016-11-18 22:38:11

标签: yii2 select2 yii2-model

我正在使用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,
            ]
        ]);

0 个答案:

没有答案