Reputation: 538
how can I set width of column of gridview in view yii2, reference link as below,
Upvotes: 7
Views: 6337
Reputation: 735
To set width of one column individually something like the following:
[
'attribute' => 'attribute_name',
'headerOptions' => ['style' => 'width:20%'],
],
For all columns try:
[
'class' => 'yii\grid\SerialColumn',
'contentOptions' => ['style' => 'width:100px;'],
],
Upvotes: 3
Reputation: 132
try this,
<?=
GridView::widget([
'model' => $model,
'options' => ['style' => 'width:80%'],
'attributes' => [
'id',
],
])
?>
Upvotes: 6