mrlco / yii2-jalali-datepicker

Yii2 Jalali datepicker is a persian datepicker
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

gridview filter #5

Closed siromidz closed 3 years ago

siromidz commented 3 years ago

hi how can I use this DatePicker to filter a date column in a Gridview? I save gregorian date and show Jalali date

mehrna commented 3 years ago

Hello @siromidz Just use it as a widget in your GridView's attribute like this:


[
    'attribute' => 'updated_at',
    'value' => 'updated_at',
    'filter' => mrlco\datepicker\Datepicker::widget([
        'model' => $searchModel,
        'attribute' => 'updated_at',
        'template' => '{addon}{input}',
        'clientOptions' => [
            'format' => 'YYYY/MM/DD' // Use any format (or any other options) you need
        ]
    ]),
    'format' => 'html',
],
siromidz commented 3 years ago

thanks but something else when I use it, it is not empty.

mehrna commented 3 years ago

when I use it, it is not empty.

What do you mean?

siromidz commented 3 years ago

when I use it, it is not empty.

What do you mean?

Untitled

how can I empty the input?(1399/12/09)

mehrna commented 3 years ago

This issue is related to this library. Have you ever seen the options of Babakhani's Persian Datepicker ?

maybe you should set initialValue to false.

siromidz commented 3 years ago

thanks. solved.