From 3abaf0d9e07106b1d07e18c46435105b0f0f7c31 Mon Sep 17 00:00:00 2001 From: RodrigoDornelles Date: Wed, 2 Dec 2020 15:17:25 -0300 Subject: [PATCH] add format_raw & format_filter | docs --- src/grid/DateColumn.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/grid/DateColumn.php b/src/grid/DateColumn.php index d509d25..3b3ebb6 100644 --- a/src/grid/DateColumn.php +++ b/src/grid/DateColumn.php @@ -3,22 +3,41 @@ namespace dynamikaweb\grid; use Yii; -use yii\helpers\Html; +/** + * DateColumn + * + * @property string|array $format Cell Date Format + * + * @property string|array $format_raw Uses when attribute not is a date + * + * @property string $format_filter Filter input mask + * + * @property string $format_filter Filter options + * + * @property string $format_filter Cell options + * + */ class DateColumn extends \yii\grid\DataColumn { public $format = 'short'; + + public $format_raw = null; + + public $format_filter = 'dd/MM/yyyy'; + public $options = []; + public $filterOptions = []; public function init () { - $this->format = ['date', $this->format]; + $this->format = empty($this->format_raw)? ['date', $this->format]: $this->format_raw; $this->filter = \yii\jui\DatePicker::widget([ 'model'=> $this->grid->filterModel, 'attribute' => $this->attribute, 'language' => Yii::$app->language, - 'dateFormat' => 'dd/MM/yyyy', + 'dateFormat' => $this->format_filter, 'options' => array_merge(['class' => 'form-control'], $this->filterOptions) ]); $this->options = array_merge(['width' => '150px'], $this->options);