Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii CListView summary text

Tags:

yii

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?

like image 212
Kamil Klimek Avatar asked May 27 '11 14:05

Kamil Klimek


3 Answers

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.

like image 110
Laith Avatar answered Oct 20 '22 09:10

Laith


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',
));
like image 11
Kamil Klimek Avatar answered Oct 20 '22 09:10

Kamil Klimek


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: ',
),
));
like image 9
Victor Zinchenko Avatar answered Oct 20 '22 10:10

Victor Zinchenko