Yii Bootstrap扩展.分页

Yev*_*huk 0 php yii twitter-bootstrap

如何配置我的小部件,他显示了屏幕上显示的结果数量?例如在标准的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(
Run Code Online (Sandbox Code Playgroud)

dIn*_*0nG 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(
Run Code Online (Sandbox Code Playgroud)

用于配置摘要文本的格式

TbGridView延伸自CGridView.所以你可以使用的summaryText属性CGridView

<?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.'
Run Code Online (Sandbox Code Playgroud)

根据文档,您可以在`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
Run Code Online (Sandbox Code Playgroud)