2017-04-03 2 views
0

私はawyome製のyii2グリッドを使用しますkartikyii2 grid-actionColumnにもっとアクションを追加

私の質問は 'kartik grid' \ actionColumnにあり、デフォルトのアクションは: ビュー、更新、および削除です。 'print'、 'email'などの別のアクションを追加する必要があります。 どうすればこのようにすることができますか?

[ 
    'class' => 'kartik\grid\ActionColumn', 
    'width' => '100px', 
    'dropdown' => false, 
    'vAlign' => 'top', 
    'hiddenFromExport' => true, 
    'urlCreator' => function ($action, $model, $key, $index) { 
     return Url::to([$action, 'id' => $key]); 
    }, 
    'viewOptions' => ['role' => 'modal-remote', 'class' => 'btn btn-xs ', 'title' => 'View', 'data-toggle' => 'tooltip'], 
    'updateOptions' => ['role' => 'modal-remote', 'class' => 'btn btn-xs btn-primary', 'title' => 'Update', 'data-toggle' => 'tooltip'], 
    'deleteOptions' => ['role' => 'modal-remote', 'class' => 'btn btn-xs btn-danger', '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'], 
], 

助言してください。

答えて

1

あなたはActionColumntemplatebuttonsオプションを使用すべきである:

[ 
    'class' => 'kartik\grid\ActionColumn', 
    'template' => '{view} {update} {delete} {myaction}', // <-- your custom action's name 
    'buttons' => [ 
     'myaction' => function($url, $model, $key) { 
      return Html::a('My action icon', [''my action url]; 
     } 
    ] 
... 
] 
関連する問題