Yii CListView summary text

yii
15,305

Solution 1

Try the following to get more control over the look of your CListView output:

'template'=>'{items} {pager}'

You can even use HTML in the template.

Solution 2

Ok, I didn't get it at first, when looking into CListView code, but setting 'summaryText' to '' will do the work. I've realised that second time when I was staring at $summaryText === null

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

Solution 3

Here is the example for 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: ',
),
));

Solution 4

You should try this:

'summaryText' => FALSE,

Solution 5

You may hide it by adding CSS in the page like below.

<style>
.summary{
display:none;
}
</style>
Share:
15,305
Kamil Klimek
Author by

Kamil Klimek

Qt5 C++ developer

Updated on July 06, 2022

Comments

  • Kamil Klimek
    Kamil Klimek 7 months

    Is there any way to hide "Summary" for CListView without loosing pagination. By summary i mean text like "Displaying 1-2 of 2 result(s).". Or maybe I should use different widget?

  • MEM
    MEM about 11 years
    Sorry, where did you set that ?
  • Kamil Klimek
    Kamil Klimek about 11 years
    $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'summaryText'=>'', 'itemView'=>'_indexview',)); in views
  • User
    User about 10 years
    It's a minor difference but I think this is potentially better than the selected answer because the selected answer will still render an empty <div class="summary"> whereas with adjusting the template you can completely remove it.
  • Kamil Klimek
    Kamil Klimek over 8 years
    hiding is not exactly solution I was looking for. It will be still generated