Yii Bootstrap扩展。分页

时间:2012-10-19 07:00:01

标签: php twitter-bootstrap yii

如何配置我的小部件,他显示了屏幕上显示的结果数量?例如在标准的CGridview分页中(对于 * 显示1到10的4087)

 <?php $this->widget('common.ext.bootstrap.widgets.TbGridView', array(
    'id'=>'search-by-name-grid',
    'type' => 'striped',
    'dataProvider'=>$dataProvider,
    'template'=>'{items}{pager}',
    'enablePagination' => true,
    'columns'=>array(

1 个答案:

答案 0 :(得分:5)

您必须在{summary}属性

中指定template
<?php $this->widget('common.ext.bootstrap.widgets.TbGridView', array(
    'id'=>'search-by-name-grid',
    'type' => 'striped',
    'dataProvider'=>$dataProvider,
    'template'=>'{summary}{items}{pager}',
    'enablePagination' => true,
    'columns'=>array(

配置摘要文本的格式

TbGridViewCGridView延伸。因此,您可以使用CGridView

summaryText属性
<?php $this->widget('common.ext.bootstrap.widgets.TbGridView', array(
    'id'=>'search-by-name-grid',
    'type' => 'striped',
    'dataProvider'=>$dataProvider,
    'template'=>'{summary}{items}{pager}',
    'enablePagination' => true,
    'summaryText'=>'Displaying {start}-{end} of {count} results.'

根据文档,您可以在`summaryText'

中使用以下标记
{start}: the starting row number (1-based) currently being displayed
{end}: the ending row number (1-based) currently being displayed
{count}: the total number of rows
{page}: the page number (1-based) current being displayed, available since version 1.1.3
{pages}: the total number of pages, available since version 1.1.3