示例#1
0
<?php

use yii\grid\CheckboxColumn;
use yii\grid\GridView;
use yii\helpers\Html;
use backend\widgets\GridViewButtonDelete;
use backend\widgets\GridViewButtonUpdate;
use backend\widgets\GridViewToggleColumn;
$this->title = 'Пользователи';
$this->params['header'] = $this->title;
$this->params['breadcrumbs'] = [$this->title];
$this->params['toolbar'] = [Html::a('<i class="fa fa-plus-circle"></i> Создать', ['update', 'id' => 0], ['class' => 'btn btn-success']), GridViewButtonUpdate::widget(), GridViewButtonDelete::widget()];
?>
<div class="box box-primary">
    <div class="box-body">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['headerOptions' => ['width' => 50], 'class' => CheckboxColumn::className()], 'name', 'email', 'role', ['class' => GridViewToggleColumn::className(), 'attribute' => 'enabled']]]);
?>
    </div>
</div>
示例#2
0
<?php

use yii\grid\CheckboxColumn;
use yii\grid\GridView;
use yii\helpers\Html;
use backend\widgets\GridViewButtonDelete;
use backend\widgets\GridViewToggleColumn;
$this->title = 'Страницы';
$this->params['header'] = $this->title;
$this->params['breadcrumbs'] = [$this->title];
$this->params['toolbar'] = [Html::a('<i class="fa fa-plus-circle"></i> Создать', ['update', 'id' => 0], ['class' => 'btn btn-success']), GridViewButtonDelete::widget()];
?>
<div class="box box-primary">
    <div class="box-body">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::className(), 'headerOptions' => ['width' => 50]], 'name', 'slug', ['class' => GridViewToggleColumn::className(), 'attribute' => 'published']]]);
?>
    </div>
</div>