Yii2 gridview fixed column width 如何设置table宽度固定

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’]

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注