Yii2.0 GridView 的强大功能

1. 去除头顶的 第1条数据 共两条 代码如下

 1 <?= GridView::widget([
 2             'dataProvider' => $dataProvider,
 3             'filterModel' => $searchModel,
 4             'columns' => [
 5                 ['class' => 'yii\grid\SerialColumn'],
 6 
 7                 'id',
 8                 'name',
 9                 'sort_order',
10                 'status',
11 
12                 ['class' => 'yii\grid\ActionColumn'],
13 
14             ],
15             'layout'=>"{items}\n{pager}", //去除顶部
16         ]); ?>

2.显示图片 

1 [
2          'attribute' => 'thumb_path',
3          'format' => 'raw',
4          'value' => function($model) {
5                  return Html::img($model->thumb_path);
6           }
7 ],
View Code

后续功能 继续添加

posted @ 2017-06-25 12:19  进阶的thinker  阅读(773)  评论(0编辑  收藏  举报