Advertisement
Guest User

cutom actioncolumn

a guest
Nov 26th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?= GridView::widget([
  2.     'dataProvider' => $dataProvider,
  3.     'filterModel' => $searchModel,
  4.     'options'=>[
  5.         'class'=>'table table-striped table-bordered bootstrap-datatable datatable',
  6.     ],
  7.     'columns' => [
  8.         ['class' => 'yii\grid\SerialColumn'],
  9.    
  10.         'id',
  11.         'username',
  12.         //'auth_key',
  13.         //'password_hash',
  14.         //'password_reset_token',
  15.         // 'email:email',
  16.         // 'role',
  17.         // 'status',
  18.         // 'createdtime:datetime',
  19.         // 'updatedtime:datetime',
  20.    
  21.         ['class' => 'yii\grid\ActionColumn',
  22.             'template'  => '{view}{update}{delete}',
  23.             'buttons' => [
  24.                 'view' => function ($url, $model) {
  25.                     return Html::a('<i class="halflings-icon white zoom-in"></i>', $url, [
  26.                                 'title' => Yii::t('app', 'Show'),
  27.                                 'class' => 'btn btn-success',
  28.                     ]);
  29.                 },
  30.                 'update' => function ($url, $model) {
  31.                     return Html::a('<i class="halflings-icon white edit"></i>', $url, [
  32.                                 'title' => Yii::t('app', 'Edit'),
  33.                                 'class' => 'btn btn-info',
  34.                     ]);
  35.                 },
  36.                 'delete' => function ($url, $model) {
  37.                     return Html::a('<i class="halflings-icon white trash"></i>', $url, [
  38.                                 'title' => Yii::t('app', 'Delete'),
  39.                                 'class' => 'btn btn-danger',
  40.                     ]);
  41.                 }
  42.                
  43.             ]
  44.         ],
  45.     ],
  46. ]); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement