我从离线来源获得了这个替代答案,为了完整起见,在此处发布。
Ionut-flavius-Pogacian 和frostyterrier 方法都有效,并且是更好的解决方案,因为定义模板可以更好地控制小部件的行为,而不是像下面的答案那样仅仅定义 summaryText
Tblistview 没有记录在 Yii-bootstrap 文档中,但是扫描源代码似乎它是 Yii 中 CListview 类的包装器。
CListview 扩展了具有 summaryText 属性的 CBaseListView。将空白数据传递给它,删除默认情况下处于活动状态的计数。
http://www.yiiframework.com/doc/api/1.1/CBaseListView#template-detail
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
{start} {end} and {count} are visible by default
代码可以修改为
$this->widget('bootstrap.widgets.TbListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'viewData'=>array('page'=>$page),
'itemsTagName'=>'table',
'itemsCssClass'=>'items table table-striped table-condensed',
'emptyText'=>'<i> Sorry, there are no active items to display</i>',
'summaryText'=>''
));