Skip to content

Commit

Permalink
add format_raw & format_filter | docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoDornelles authored Dec 2, 2020
1 parent 5938e5c commit 3abaf0d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/grid/DateColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3abaf0d

Please sign in to comment.