Hello all,
I hope this is a very easy question.
I’m trying to search an item and display it (w/ pagination) using CListView.
This is what I have working.
View
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'id' => '#qwerty',
'pager' => array(
'firstPageLabel'=>'<<',
'prevPageLabel'=>'<',
'nextPageLabel'=>'>',
'lastPageLabel'=>'>>',
'maxButtonCount'=>6,
),
'itemView'=>'_view',
)); ?>
Controller
if(isset($_POST['buscar_amigo']))
$criteria->addCondition("nombre like '%".$_POST['buscar_amigo']."%' or apellido like '%".$_POST['buscar_amigo']."%'");
$dataProvider=new CActiveDataProvider('Personas', array(
'criteria'=>$criteria
,
'pagination'=>array(
'pageSize'=>12,
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
This works fine, but as when I press the “>” to see the next page of results the $_POST[‘buscar_amigo’] is lost.
Thus instead of showing 50 pages (search result) it resets to 150 pages (all database).
How can I keep this variable alive throughout the pagination?
Thanks