Skip to content

Commit

Permalink
Test Formatter in Gridview
Browse files Browse the repository at this point in the history
  • Loading branch information
gugoan committed Apr 27, 2015
1 parent abf28a4 commit d27a059
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
18 changes: 5 additions & 13 deletions views/cashbook/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@
// },
'columns' => [
[
//'label' => 'Dia',
'attribute' => 'date',
'enableSorting' => true,
'format' => ['date', 'php:d/m/Y'],
//'format' => ['date', 'php:d/m/Y'],
//'value' => Yii::$app->formatter->asDate($model->date, 'short'),
'value' => function ($model) {
return $model->date <> '' ? Yii::$app->formatter->asDate($model->date, 'short') : Yii::$app->formatter->asDate($model->date, 'short');
},
'contentOptions'=>['style'=>'width: 10%;text-align:left'],
],
[
//'label' => 'Categoria',
'attribute' => 'category_id',
'format' => 'raw',
'enableSorting' => true,
Expand Down Expand Up @@ -120,16 +122,6 @@
'footer' => Cashbook::pageTotal($dataProvider->models,'value'),
'footerOptions' => ['style'=>'text-align:right'],
],
//'id',
//'category_id',
//'type_id',
//'value',
//'description',
// 'date',
// 'is_pending',
// 'attachment',
// 'inc_datetime',
// 'edit_datetime',
],
]); ?>

Expand Down
5 changes: 1 addition & 4 deletions views/cashbook/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
'value' => $model->type->desc_type,
],
[
//'label' => 'Categoria',
'attribute' => 'category_id',
'value' => $model->category->desc_category,
],
Expand All @@ -68,12 +67,10 @@
[
'attribute' => 'inc_datetime',
'value' => Yii::$app->formatter->asDate($model->inc_datetime, 'long'),
//'inc_datetime:datetime',
// 'format' => ['date', 'd/M/Y H:m:s'],
],
[
'attribute' => 'edit_datetime',
'value' => Yii::$app->formatter->asDate($model->inc_datetime, 'short'),
'value' => Yii::$app->formatter->asDate($model->inc_datetime, 'long'),
//'format' => ['date', 'd/M/Y H:m:s'],
],
],
Expand Down

0 comments on commit d27a059

Please sign in to comment.