Strange Behavior With Filtering After A Sort

I am encountering a very strange behavior with the GridView Sorting and Filtering. The filtering on its own works with no problems, and the sorting too. But after I sort, the filtering doesn’t update the search model with the filter values. After going through the code for hours I have encountered something very bizarre in the requests sent to the action from gridview during sorting.

URL Before sort:


?EsIssue%5Bid%5D=&EsIssue%5Bobj_name%5D=crm&EsIssue%5Bcategory%5D=&EsIssue%5Btitle%5D=&EsIssue%5Blast_comment%5D=&EsIssue%5Blast_status%5D=&EsIssue%5Bcreator_name%5D=&EsIssue%5Bdate_created%5D=&EsIssue_page=1&ajax=yw0

URL on sort:


/EsIssue%5Bid%5D//EsIssue%5Bobj_name%5D/crm/EsIssue%5Bcategory%5D//EsIssue%5Btitle%5D//EsIssue%5Blast_comment%5D//EsIssue%5Blast_status%5D//EsIssue%5Bcreator_name%5D//EsIssue%5Bdate_created%5D//EsIssue_page/1/ajax/yw0/EsIssue_sort/last_comment?ajax=yw0

URL filter after sort:


EsIssue%5Bid%5D//EsIssue%5Bobj_name%5D/crm/EsIssue%5Bcategory%5D//EsIssue%5Btitle%5D//EsIssue%5Blast_comment%5D//EsIssue%5Blast_status%5D//EsIssue%5Bcreator_name%5D//EsIssue%5Bdate_created%5D//EsIssue_page/1/ajax/yw0/EsIssue_sort/last_comment?EsIssue%5Bid%5D=&EsIssue%5Bobj_name%5D=test&EsIssue%5Bcategory%5D=&EsIssue%5Btitle%5D=&EsIssue%5Blast_comment%5D=&EsIssue%5Blast_status%5D=&EsIssue%5Bcreator_name%5D=&EsIssue%5Bdate_created%5D=&EsIssue_page=1&ajax=yw0

I don’t even know where to start to find fix the issue. What I am seeing is that the the new filter GETs are appeneded to the old ones that are in the path format. I want to make filter and sort to have only path or only query string but not both. What can I do? My url manager is pretty simple:


'urlManager' => ['urlFormat' => 'path',

		 'showScriptName' => false,

		 'rules' => [

                     '<controller:\w+>/<id:\d+>'=>'<controller>/view',

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

                     '/'=>'/core'

                ]]



This behavior happens on every GridView throughout the entire system.

Thank you in advance,

Gasim Gasimzada

Is your controller in a subdirectory or module? if so, try adding this rule here:




'<controller:\w+>/<id:\d+>'=>'<controller>/view',

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

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

'/'=>'/core'



Thank you!

I just realized that, adding the module line to the URLs breaks the path look to the query string parameters. I mean, /core/entity/view/id/100 becomes /core/entity/view?id=100. How can I make it path again?

This part of the guide states:

I’m not sure whether you need an extra rule before the existing one or whether you can simply append /* to the end of that one, but you should be able to get it to work with a little experimentation.