Mykyta Popov
Mykyta Popov

Reputation: 67

Yii2 kartik DatePicker in modal issue

The kartik's DatePicker is not renders calendar when input clicked if DatePicker positioned in the modal rendered by renderAjax method.

controller:

$this->renderAjax('modal');

modal.php:

<?= DatePicker::widget(['name' => 'test']) ?>

Outside of modal DatePicker works fine, but in mode it does not works.

Any idea how to solve this issue?

Upvotes: 0

Views: 2070

Answers (2)

Mykyta Popov
Mykyta Popov

Reputation: 67

The problem was with DatePicker type. Date picker not working only in two cases, if type is not set or if type set as TYPE_INPUT, any else types are works for me...

Upvotes: 0

Francis Ngueukam
Francis Ngueukam

Reputation: 1024

The property tabindex of the modal disturb sometimes many libraries. Remove it by adding this script to the view you are rendering in the modal.

<script type="text/javascript">
   $(document).ready(function(){
     $('#id_of_your_modal_window').removeAttr('tabindex');
   });
</script>

Upvotes: 1

Related Questions