Extend GridView ActionColumn with additional icon

前端 未结 3 942
轻奢々
轻奢々 2020-12-05 05:18

I\'m building a webapp with Yii2 framework that will provide users (logged in) the capability to download pre-uploaded files by administrators.

I\'ve created the act

3条回答
  •  既然无缘
    2020-12-05 05:19

    template attribute is important

    echo GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
             'id', 
             'title',
            ['class' => 'yii\grid\ActionColumn',
                'buttons' => [
                    'additional_icon' => function ($url, $model, $key) {
                        return Html::a ( ' ', ['controller/action', 'id' => $model->id] );
                    },
                ],
                'template' => '{update} {view} {delete} {additional_icon}'
    
    
            ],
        ],
    ]);
    

提交回复
热议问题