miércoles, 10 de agosto de 2016

Grid en yii2

# views/page/index.php
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'user.username',
[
'header' => 'Live?',
'value'=>function($data) {
return ($data->live == 1) ? "Live" : "Draft";
}
],
'title',
[
'header' => 'Snippet',
'value'=>function($data) {
return substr($data->content, 0, 100);
},
'format' => 'html'
],
'content:html',

// 'date_updated',
// 'date_published',
['class' => 'yii\grid\ActionColumn'],
],
)); ?>

No hay comentarios:

Publicar un comentario