Hello, I don’t know if this is my mistake, a bug, or the widget is intended to work this way.
The problem is my gridview ignores any filter change after changing the page. If, for example, I go to page 2, back to one, and then filter my model’s name to ‘John’, the displayed rows are exactly the same, and the filter input will be blank as before instead of ‘John’
I really need help for this, I have been trying to find out what is wrong and don’t have a clue so far.
see also afterAjaxUpdate attribute in the CGridView class definition. this attribute points to a JS method, IF your CGridView has attached some customized JS functions then you must call them again after pagination or sorting.
<br><br>
'afterAjaxUpdate' => "function(){ do some stuff after pagination or sorting }"
<br>or
'afterAjaxUpdate' => "my_function_name"
<br><br>normally this works fine without using afterAjaxUpdate when using the provided filter mechanism, maybe your are using a customized filtered method or maybe an outdated Jquery version.<br>
maybe a outdated jquery version, use the default provided by yiiframework, and…update your framework. try removing your assets and taking a look at your runtime/application.log and to the browser reported errors (control shift i in your browser displays the error console).
Now that I know what’s wrong, I have found some people had this same problem before and solved it their own way, I’m still surprised this hasn’t been fixed yet (?)
Thread 1
Thrad 2
Thank you all for your help!
EDIT: In case anyone has to fix this, the best solution for me seems to be adding ‘ajaxUrl’ => $this->createUrl(‘whatever’) to the CGridView.
Personally I don’t think it’s a bug in Yii, but I do think that the url rules can be difficult to manage when you have a module. Showing your url rules may help someone.