Skip to content

Commit

Permalink
Merge pull request #1 Create DateColumn
Browse files Browse the repository at this point in the history
Create DateColumn
  • Loading branch information
RodrigoDornelles authored Nov 30, 2020
2 parents 26beb7c + 8a37209 commit df5a4b2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/grid/DateColumn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace dynamikaweb\grid;

use Yii;
use yii\helpers\Html;

class DateColumn extends \yii\grid\DataColumn
{
public $format = 'short';
public $options = [];
public $filterOptions = [];

public function init ()
{
$this->format = ['date', $this->format];
$this->filter = \yii\jui\DatePicker::widget([
'model'=> $this->grid->filterModel,
'attribute' => $this->attribute,
'language' => Yii::$app->language,
'dateFormat' => 'dd/MM/yyyy',
'options' => array_merge(['class' => 'form-control'], $this->filterOptions)
]);
$this->options = array_merge(['width' => '150px'], $this->options);

parent::init();
}
}

0 comments on commit df5a4b2

Please sign in to comment.