Yii2 DatePicker onSelect未调用

时间:2017-06-21 20:50:44

标签: jquery datepicker yii2

我有一个DatePicker小部件:

docker exec -ti container_name bash
dotnet --version 

但是在选择约会时我没有看到任何事情发生,我缺少什么?

更新(1)

我尝试了两个DatePicker:

<?= $form->field($model, 'startDate')->widget(DatePicker::classname(), [
      'clientOptions' => [
        'maxViewMode' => 2,
        'todayBtn' => "linked",
        'daysOfWeekDisabled' => "0,1",
        'autoclose' => true,
        'onSelect' => new \yii\web\JsExpression('function(dateText, inst) { console.log(dateText, inst) }')
      ],
      'language' => 'fr'
    ])?>

这是生成的javascript:

<div class="col-lg-4">
    <?= $form->field($model, 'startDate')->widget(DatePicker::classname(), [
      'clientOptions' => [
        'maxViewMode' => 2,
        'todayBtn' => "linked",
        'daysOfWeekDisabled' => "0,1",
        'autoclose' => true,
        'onSelect' => new \yii\web\JsExpression('function(dateText, inst) { alert("Hi"); }')
      ],
      'language' => 'fr'
    ])?>
    </div>
<div class="col-lg-4">
    <?= $form->field($model, 'stopDate')->widget(DatePicker::classname(), [
      'clientOptions' => [
        'maxViewMode' => 2,
        'todayBtn' => "linked",
        'daysOfWeekDisabled' => "0,1",
        'autoclose' => true,
        'onSelect' => 'alert("Hi")'
      ],
      'language' => 'fr'
    ]) ?>
</div>

顺便说一下,这种语言也不起作用,也许两个问题都有联系?

0 个答案:

没有答案