CGridView pagination and filtering question

Hi All,

Just a quick question re CGridView.

I have setup GridView with pagination and filtering which works great however, when I paginate through the results and then, say for this example I am on page 4, if I add a filter string in the text box the grid will refresh with the correct filtering but the grid will stay on page 4.

Is this by design? Surely when filtering the results the grid should reset back to page 1 as it will have a new dataset?

Thanks.

This is the default design.

The gridView by default will save even the sorting when a new search is needed.

Technucally, there is no difference at all when a new search is done, there is no a standard way for detect this event.

mmm… sherbert… thanks!

Has anyone implemented a work around for this?

Hopefully get a positive response before I start digging around for a solution :)

I added a redirect that seems to work, not sure if this is the best approch.




public function actionAdmin()

	{

		$model=new Prjmaster('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Prjmaster'])) {

			$model->attributes=$_GET['Prjmaster'];

		$this->redirect(array('admin')); // added this

		}

		$this->render('admin',array(

			'model'=>$model,

			

		));

		

	}