English 中文(简体)
Yii CList查看摘要文本
原标题:Yii CListView summary text
  • 时间:2011-05-27 14:01:48
  •  标签:
  • yii

有没有任何方法可以在不丢失分页的情况下隐藏CListView的“摘要”。我的意思是“显示1-2个结果”。或者我应该使用不同的小部件?

最佳回答

请尝试以下操作以更好地控制CListView输出的外观:

 template => {items} {pager} 

您甚至可以在模板中使用HTML。

问题回答

好吧,我一开始在查看CListView代码时没有得到它,但将summaryText设置为将完成这项工作。当我第二次盯着$summaryText===null时,我意识到了这一点

$this->widget( zii.widgets.CListView , array( 
      dataProvider =>$dataProvider, 
      summaryText =>  , 
      itemView => _indexview ,
));

以下是CListView的示例:

$this->widget( zii.widgets.CListView , array(
 dataProvider  => $dataProvider,
 itemView  =>  _view ,
 ajaxUpdate  => false,
 emptyText  =>  No records found. ,
 summaryText  => "{start} - {end} из {count}",
 template  =>  {summary} {sorter} {items} {pager} ,
 sorterHeader  =>  Sort by: ,
 sortableAttributes  => array( title ,  price ),
 pager  => array(
     class  =>  CLinkPager ,
     header  => false,
     cssFile  =>  /css/pager.css ,
     htmlOptions  => array( class  =>  pager ),
     maxButtonCount  =>  10 ,
     prevPageLabel => ← ,
     nextPageLabel => → ,
     header => Pages:  ,
),
));

你应该试试这个:

 summaryText  => FALSE,

您可以通过在页面中添加CSS来隐藏它,如下所示。

<style>
.summary{
display:none;
}
</style>

这是我的建议

  $this->widget( zii.widgets.CListView , array(
         dataProvider  => $best_seller_data,
         itemView  =>  alsoBestseller ,
     summaryText =>false, 
    ));




相关问题
how to change a model safe attributes in yii

I have a CActiveRecord model, and I need to change safe attributes list in that model. I have defined the safeAttributes method inside my model, like the following : public function safeAttributes() {...

Accessing a module s action rendered output

I m writing an "Account" module which should take care of everything about accounts: registration, login/logout, user administration, password recovery, account activation, etc. So I thought it would ...

yii components: events and behaviors?

i m currently learning the yii framework and have read their documentation. but i still don t understand the components. what are these. they talk about component events and behaviors. could someone ...

Yii: Customize the results of CAutoComplete

I need to make a dropdown list using CAutoComplete. Everything is set and works fine, here is my code of the action: <?php public function actionSuggestCharacter() { if(Yii::app()->...

热门标签