Add this in views/index.php
use yii\helpers\Html; use yii\widgets\Pjax; use kartik\grid\GridView; use yii\helpers\ArrayHelper; use backend\models\Studentuser; use kartik\export\ExportMenu; <?php $gridColumns = [ //['class' => 'yii\grid\SerialColumn'], ['class' => 'kartik\grid\SerialColumn'], [ 'attribute'=>'studentuser_studentNo ', 'label'=>'Student No.', 'vAlign'=>'middle', 'width'=>'190px', 'value'=>function ($model, $key, $index, $widget) { return Html::a($model->studentuser_studentNo, '#', []); }, 'format'=>'raw' ], 'studentLastName', 'studentFirstName', 'semester', 'schoolYear', 'coursesWithProctoredExam', 'typeOfExam', 'examDate', [ 'attribute' => 'listofvenues.displayname', 'format' => 'text', 'label' => 'Exam Venue', ], ['class' => 'kartik\grid\ActionColumn'], ]; ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, // 'export' => [ // 'fontAwesome' => true, // ] 'floatHeader'=>true, 'floatHeaderOptions'=>['scrollingTop'=>'50'], 'showPageSummary' => true, 'toolbar' => [ [ 'content'=> Html::button('<i class="glyphicon glyphicon-plus"></i>', [ 'type'=>'button', 'title'=>Yii::t('kvgrid', 'Apply for Exam'), 'class'=>'btn btn-success' ]) . ' '. Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], [ 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid') ]), ], '{export}', '{toggleData}' ], 'panel' => [ 'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i>Exam Application</h3>', 'type'=>'success', 'before'=>Html::a('<i class="glyphicon glyphicon-plus"></i> Apply for an Exam', ['create'], ['class' => 'btn btn-success']), 'after'=>Html::a('<i class="glyphicon glyphicon-repeat"></i> Reset Grid', ['index'], ['class' => 'btn btn-info']), 'footer'=>false ], ]); ?>
Add this to config/main.php
'modules' => [ 'gridview' => [ 'class' => '\kartik\grid\Module', // your other grid module settings ], 'gridviewKrajee' => [ 'class' => '\kartik\grid\Module', // your other grid module settings ],],
0 Comments