我有一个使用YII2框架和kartik小部件的项目。我在使用kartik的datepicker时遇到问题,当我在项目中使用datepicker类时,datepicker没有显示日历。
如何解决这个问题?
这是我的观点代码
<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\widgets\DatePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\TbInputStok */
/* @var $form kartik\widgets\ActiveForm */
$this->title = 'Input Barang Masuk';
?>
<div class="tb-input-stok-inputStok">
<h1><?= $this->title ?></h1>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama')->textInput(['disabled'=>'disabled', 'value' => $modelKaryawan->nama]) ?>
<?= $form->field($model, 'nama_barang')->textInput(['disabled' => 'disabled', 'value' => $modelBarang->nama_barang]) ?>
<?= $form->field($model, 'jumlah')->textInput() ?>
<?= $form->field($model, 'tanggal')->widget(DatePicker::classname(), [
'options' => ['placeholder' => 'Enter event time ...'],
'pluginOptions' => [
'autoclose' => true
]
]); ?>
<?= $form->field($model, 'foto_surat_jalan')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'id_barang')->hiddenInput(['value' => $modelBarang->id_barang])->label(false) ?>
<?= $form->field($model, 'id_karyawan')->hiddenInput(['value' => $modelKaryawan->id_karyawan])->label(false) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Tambah' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>