D
D
Doniyor Mamatkulov2016-08-10 09:35:34
Yii
Doniyor Mamatkulov, 2016-08-10 09:35:34

DatePicker in Yii2 GridView not working?

Hey! I made a GridView on Yii2 and installed a datepicker from a kartik use kartik\widgets\DatePicker. Set up the display of the datepicker like this:

'attribute' => 'register_date',
                    'format' =>  ['date', 'dd.MM.Y'],
                    'headerOptions' => ['width'=>'120', 'style'=>'text-align:center'],
                    'filter' => DatePicker::widget([
                        'name' => 'register_date',
                        'language' => 'ru',
                        'type' => DatePicker::TYPE_INPUT,
                        'pluginOptions' => [
                            'autoclose'=>false,
                            'format' => 'yyyy-mm-dd',
                        ]
                    ])

In my database, this field stores the date in the format 2016-08-05.
Now if you select a date in the datepicker, the page stupidly reloads and no filtering occurs.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Arutyunov, 2016-08-10
@arutyunov

Did you forget to configure $searchModel?

I
Igor Vasiliev, 2016-08-11
@Isolution666

And if you write simply
You use html5?
In theory, the calendar should be displayed anyway, although not in all browsers...
Perhaps Cyril was right, if the search in the GridView is not configured, then even this will not save. After all, the input will send data by date to nowhere))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question