Hi all,
I’m a little stuck…I have a _form.php with a datepicker and one Select2-Dropdown:
<?php
Pjax::begin(['id' => 'pjax-employee-dropdown','enablePushState' => false]);
$data = ArrayHelper::map(Employee::getEmployee($model->fromDate),'id','name');
?>
<?= $form->field($model, 'id')->widget(Select2::classname(),['id' => 'sel-pers-id',data' => $data,]) ?>
<?php Pjax::end() ?>
<?= $form->field($model, 'fromDate')->widget(DatePicker::classname(), [
'language' => 'de',
'options' => [
'id' => 'start-date-id',
],
'type' => DatePicker::TYPE_INPUT,
'pluginOptions' => [
'format' => 'dd.mm.yyyy',
'todayHighlight' => true,
'autoclose' => true,
],
'pluginEvents' => [
'changeDate' => 'function(e) {
$.pjax.reload({container: "#pjax-employee-dropdown", async: false, timeout: false});
}'
],
]) ?>
What I’m trying todo: the Select2 should reload after the Date is changed and the function getEmployee() should be called with the now selected date. As you can see, I tried to reload via pjax, but how can I pass the actual value of the datepicker to the function?
Any help, tip, whatever would be highly appreciated, as I’m also lacking javascript skills…
Thanks in advance and I wish you all a happy and healthy new year.