CGridview pagination showing results of the previous page

For me, CGridview is showing results of the previous page, if the page can’t be filled fully. Is there a way to turn it off, so that only the results of the next page are shown, and the results of the previous page get removed?

I’ve not encountered that problem with CGridView. It sounds like you’ve misconfigured something or your data is being populated incorrectly. By default, you should be seeing different records on each page, regardless of whether the page is full or not.

This is my gridview configuration:


	$this->widget('zii.widgets.grid.CGridView', array(

		'pager' => array('cssFile' => FALSE),

		'cssFile' => FALSE,

		'id' => 'branch-grid',

		'dataProvider' => $model->search(),

		'selectionChanged'=>'function(id){openDetailPage(id, ' . CJavaScript::encode($model->primaryKey) . ')}',

		'afterAjaxUpdate' => 'roundCorners',

		'filter' => $model,

		'columns' => array(





I don’t see any obvious issues there. Your data provider and filter will be determining the rows to return, so you should check that they are behaving correctly. Does the data come from more than one table?

No, it just contains a data provider with very basic criteria. Anyway, from what I can remember, we have always had this issue. I can’t remember not having results from the previous page showing up on the second (last) page.

So the conclusion I drawed, is that this is just some kind of ‘feature’ in either the gridview, pagination or dataprovider.

Are you using SQL Server? There seems to be a problem described here:

That may sort you out.