Extend GridView ActionColumn with additional icon

前端 未结 3 941
轻奢々
轻奢々 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:40

    How to add another action button in kartik-v yii2 grid action column?

    Just see following example.I have added copy button.

    [
        'class' => 'kartik\grid\ActionColumn',
        'dropdown' => false,
        'vAlign'=>'middle',
        'template' => '{delete} {view} {update} {copy}',
        'urlCreator' => function($action, $model, $key, $index) { 
                return Url::to([$action,'id'=>$key]);
        },
        'buttons'=>[
            'copy' => function ($url, $model, $key) {
                return Html::a('', ['copy', 'id'=>$model->id],['title'=>'Copy']);
            },
        ],      
        'viewOptions'=>['role'=>'modal-remote','title'=>'View','data-toggle'=>'tooltip'],
        'updateOptions'=>['role'=>'modal-remote','title'=>'Update', 'data-toggle'=>'tooltip'],
        'deleteOptions'=>['role'=>'modal-remote','title'=>'Delete', 
                          'data-confirm'=>false, 'data-method'=>false,// for overide yii data api
                          'data-request-method'=>'post',
                          'data-toggle'=>'tooltip',
                          'data-confirm-title'=>'Are you sure?',
                          'data-confirm-message'=>'Are you sure want to delete this item'], 
    ],
    

提交回复
热议问题