Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo GridView::widget(
- [
- 'dataProvider' => $pList,
- 'showOnEmpty'=>true,
- 'columns' => [
- [
- 'label' =>"Поле1",
- 'attribute' => 'field1',
- 'format' => 'text' //=>"raw", "text", "html", ['date', 'php:Y-m-d']).
- 'contentOptions' => ['class' => 'text-center'],
- 'headerOptions' => ['class' => 'text-center']
- ],
- [
- 'label' =>"Поле2",
- 'attribute' => 'field2',
- 'format' => 'raw',
- 'value'=>function($data){return $data['field2']?'<span class="icon-u">✔</span>':''; }
- ],
- ['class' => 'yii\grid\ActionColumn',
- 'buttons' => [
- 'update' => function ($url, $model, $key) use($myVariable) {
- return Html::a('','', ['class'=>'glyphicon glyphicon-pencil','data-cmd'=>'edit','data-id'=>$key]);
- },
- 'delete' => function ($url, $model, $key) use($myVariable) {
- return Html::a('','', ['class'=>'glyphicon glyphicon-trash','data-cmd'=>'delete','data-id'=>$key]);
- },
- 'view' => function ($url, $model, $key) use($myVariable) {
- return '';
- }
- ],
- ],
- ],
- ]
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement