Reputation: 12391
I want to apply class on table generated by GridView::widget()
in Yii2.
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'mobile_number',
'email:email',
'name',
'national_id',// and so....
How can I apply the CSS on the table GridView::widget()
? I want to apply this:
<table class="table tblSec">
Upvotes: 2
Views: 6538
Reputation: 22144
You can use tableOptions
property for this:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table tblSec'],
// ...
]) ?>
Upvotes: 14