CGridView pagination and filtering


I have a problem with filtering my CGridView.

I filter the data from a CActiveForm and all works fine unless I start paginate the grid.

when I go to page number 2 the filter doesn’t work more.

from bugzilla the generated url for the search (username=p) on the first page is:

http://localhost/siteMVC2/index.php/admin/user/admin?User[Username]=p&User[DB]=&User[IsActive]=&ajax=user-grid (it works well)

on page number 2 the same search gives the following url:


the results aren’t filetered.

any help would be appreciated.

problem resolved following the suggestion in:

It was a routing problem. Using the grid from a module needs adding the folloowing rule to urlManager:


Thanks for figuring that one out for me! I was having a painful time until I found this thread. Nice work! It should be noted that this problem only occurred for me when using the grid from a module AND setting the urlFormat to PATH.

As off Yii 1.1.8 this workaround doesn’t work anymore, at least for my config:

   'urlManager' => array(

  	'urlFormat' => 'path',


  	'rules' => array (

           '<module:\w+>/<controller:\w+>/<action:\w+>' =>  '<module>/<controller>/<action>',



But it seems that passing explicitly the ajaxUrl in the widget inclusion solves the problem:

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

	'id' => 'whois-grid',

	// blah blah blah


   // ...