GridView::widget([
'tableOptions' => ['style' => 'table-layout: fixed;'],
'columns' => [
'attr1',
'attr2',
'attr3',
['attribute' => 'attr4', 'options' => ['style' => 'width:10em']],
'attr5',
]
// ...
])
其中关键代码是:’style’ => ‘table-layout: fixed;’ 和 ‘options’ => [‘style’ => ‘width:10em’]