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);