我是 yii2 的新手 .. 如何将 css 应用于 yii2 gridview 的列、列标题?
<?php
$gridColumns = [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\CheckboxColumn'],
'name',
'company_mail', //change the color of heading
'no_employees',
'email:email',
.
.
.];
echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns,
]);
?>
Run Code Online (Sandbox Code Playgroud)
小智 6
您可以使用这种方式设置特定的列样式/css。
$columns = [
'onenormalcolumn',
'anothercolumn',
[
'format'=>"ntext", // or other formatter
'attribute' => 'theattributeofmodel',
'contentOptions' => ['style' => 'width:50px'], // For TD
'headerOptions' => ['class' => 'ur-class'] // For TH
]
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4485 次 |
| 最近记录: |