Hi all,
I have the issue that my pagination is not working.
When I deactive the pagination for my CListView the calculated amount of Items and the displayed items are correctly displayed.
E.g. Displaying 1-3 of 3 result(s).
If I activate my pagination by adding the pagination setting
return new CActiveDataProvider('User', array('criteria' => $criteria,'pagination'=>array(
'pageSize'=>'2',
), ));
I get an active pagin with the Page 1 and 2, but one item is missing.
On the First Page I get this message: Displaying 1-1 of 3 result(s).
My Code for the View:
<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-form form').submit(function(){
$.fn.yiiListView.update('ajaxListView', {
data: $(this).serialize()
});
return false;
});
");
....
<div id="searchresult" class="row">
<h2>Gefundene Coaches: </h2>
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$model->search(),
'itemView'=>'_listview',
'id'=>'ajaxListView',
'enablePagination'=>true,
));
?>
</div>
My Code in my Controller:
public function actionCashgamecoach()
{
$this->setFullLayout();
....
$model=new User('coachsearch');
$model->unsetAttributes(); // clear any default values
$model->id_gametype = GameType::ID_CASHGAME;
if(isset($_GET['User']))
$model->attributes=$_GET['User'];
$this->render('cashgamecoach', array('model' => $model, ...);
}
and finally my Code in my User Model:
public function search()
{
...
$criteria = $this->mainsearch($subcriteria);
return new CActiveDataProvider('User', array('criteria' => $criteria,'pagination'=>array(
'pageSize'=>'2',
), ));
}
}
Any suggestion why the result is not displayed properly?
Thanks and regards!
Oliver