Yii Framework Forum: CGridview pagination showing results of the previous page - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CGridview pagination showing results of the previous page Rate Topic: -----

#1 User is offline   Flaxis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 19-July 12

Posted 19 July 2012 - 04:06 AM

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?
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,707
  • Joined: 04-March 10
  • Location:UK

Posted 19 July 2012 - 04:09 AM

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.
0

#3 User is offline   Flaxis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 19-July 12

Posted 19 July 2012 - 04:14 AM

This is my gridview configuration:
	<?php 
	$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(
			'value'
		),
	));
	?>

0

#4 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,707
  • Joined: 04-March 10
  • Location:UK

Posted 19 July 2012 - 04:25 AM

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?
0

#5 User is offline   Flaxis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 19-July 12

Posted 19 July 2012 - 04:30 AM

View PostKeith, on 19 July 2012 - 04:25 AM, said:

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.
0

#6 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,707
  • Joined: 04-March 10
  • Location:UK

Posted 19 July 2012 - 04:36 AM

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

http://www.yiichina....gination-mssql/

That may sort you out.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users