I have a simple CGridView that loads from CActiveDataProvider. At the moment, and I'm not sure how long this has been happening, it does not display all the data items in the view with pagenation enabled.
My heading displays "Showing 1-7 of 9 results", but there are no buttons for more pages. If I set the pageSize value of the pagenation property of the data provider to a small number, I end up with search buttons, but it looks like there will be fewer elements on the first page than on the second page. For example, if I set pageSize for CActiveDataProvider to 3, I get 2.2.3 (positions on each page) instead of 3.3.1, as I would expect.
If I set pageSize to anything between 9 and 11 inclusive, there are elements that I donβt see because I get only one page, and not all elements are displayed ("1-6 of 9" if I set pageSize to 9 )
$criteria=new CDbCriteria; $criteria->with = array('registrations'); $criteria->addCondition('registrations.id IS NOT NULL'); $criteria->addCondition('registered = false'); $criteria->together = true; $dataProvider = new CActiveDataProvider('Skier', array('criteria'=>$criteria)); $this->widget('zii.widgets.grid.CGridView', array( 'dataProvider'=>$dataProvider, 'columns'=>array( array('name'=>'fullname', 'header'=>'Name'), array( 'name'=>'programs_names', 'header'=>'Programs', 'value'=>'$data->programs_names', ), <More items here> ) ));
Can anyone think what might make pagenation so fun?
Change Also, changing CActiveDataProvider to CArrayDataProvider works correctly, and I get 9 out of 9 results. This will work now because I have small data sets, but I would rather find out what the problem is.
$dataProvider = new CArrayDataProvider(Skier::model()->findAll($criteria));