我在Yii2中有一个常见的GridView。
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table table-striped table-bordered table-responsive'],
'columns' => [
'firstName',
'lastName',
[
'attribute' => 'verified',
'format' => 'html',
'value' => function($data){
....
}
],
]
]); ?>
GridView在移动设备中没有响应。如何使GridView页面响应?
答案 0 :(得分:3)
正如Bootstrap documentation中所述:
通过在
中包装任何.table
.table-responsive
来创建自适应表格
所以只需将您的小部件包装在
中<div class="table-responsive">
// GridView here
</div>
答案 1 :(得分:2)
这是右键选项。
<?= GridView::widget([
'tableOptions' => [
'class' => 'table table-striped',
],
'options' => [
'class' => 'table-responsive',
],
'dataProvider' => $dataProvider,