Yii GridView 小部件 - 居中对齐分页
Yii GridView widget - center align pagination
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class=''>{pager}</div>",
'columns' => $columns,
]);
默认情况下,GridView 小部件将分页呈现为 ul
标记,我想将其更改为使用 table
。
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='text-center'>{pager}</div>",
'columns' => $columns,
]);
align="center"
可以胜任您的工作。见代码。
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div align='center'>{pager}</div>",
'columns' => $columns,
]);
对于 bootstrap 4 小部件使用 justify-content-center
例如:
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='d-flex justify-content-center'>{pager}</div>",
'columns' => $columns,
]);
或
<div class="d-flex justify-content-center">
<?= LinkPager::widget([
'pagination' => $pagination,
]) ?>
</div>
对于 bootstrap4
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='mx-auto'>{pager}</div>",
'columns' => $columns,
]);
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class=''>{pager}</div>",
'columns' => $columns,
]);
默认情况下,GridView 小部件将分页呈现为 ul
标记,我想将其更改为使用 table
。
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='text-center'>{pager}</div>",
'columns' => $columns,
]);
align="center"
可以胜任您的工作。见代码。
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div align='center'>{pager}</div>",
'columns' => $columns,
]);
对于 bootstrap 4 小部件使用 justify-content-center
例如:
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='d-flex justify-content-center'>{pager}</div>",
'columns' => $columns,
]);
或
<div class="d-flex justify-content-center">
<?= LinkPager::widget([
'pagination' => $pagination,
]) ?>
</div>
对于 bootstrap4
GridView::widget([
'dataProvider' => $dataProvider
'layout' => "{summary}\n{items}\n<div class='mx-auto'>{pager}</div>",
'columns' => $columns,
]);