I’ve been struggling with what I now identify as a bug : in certain circumstances the ajax Search box which is included in the admin page created by Gii CRUD, is not working properly.
Here is a setp-by-step to reproduce :
Pre-requisite : a database connection, a table in this DB, and let’s say 20 rows in this table (at least more than 10)
- create a fresh yii application (command webapp)
- modify the webapp config[list]
- enable Gii module
- configure DB component
- enable urlManager with ‘urlFormat’ set to ‘path’ (just uncomment the default urlManager initialisation bloc created automatically by the webapp command
go to the Gii page (first login as admin/admin)create a model for your tablecreate a module that we will call modmodify the configuration and declare this new module[*]create a CRUD for your model
- we want to create this CRUD inside an ‘admin’ folder, itself part of our mod module. The Controller ID should then be mod/admin/main (yes, my controller’s name is main)
- check that the preview is ok, and click ‘generate’
[/list]We are done. Now let’s go to the ‘admin’ page inside our module. The route is ‘index.php/mod/admin/main’ because remember that we activated the url path format.
We land on the default action that displays a list of all items currently stored on the DB. Now let’s click on the ‘manage XXXX’ link to see the CGridView. As we have a lot of items in our table, several pages should be available. Now careful :
- open the search box and perform a search that will return all items. For instance, if you have a ID field, you can set the condition ‘<> anything’ … all items will be returned
- navigate to the second page
- perform the very same search as before
Let’s notice that I didn’t write any piece of code, but just made some very basic configuration… and it is easely reproductible (althought it took me a while to isolate this scenario)
The error happens only if :
[list=1]we are doing this from within a modulethe urlFormat is set to path[/list]By taking a look at the HTTP Request Header, I could se that the RequestURL is messed up and I assume that Yii fails to parse query string parameters.