First I try with a normal grid (created manually, so not using CGridView), I created a MyLinkPager.php where I override the CLinkPager "run" function by adding at the end a textField (Id="rowPages") with a link button "GO" that if pressed resubmit the form, then in the controller action "List" I check if $_POST['rowPages'] is set and I change the pageSize property of MyLinkPager. This functions perfectly.
Now I want it to function in CGridView in Ajax mode, but I'm not able.
First i specified in the CGridView to use 'pager'=>'myLinkPager', then, as previously done, in myLinkPager at the end of "run" function I used a textField ('rowPages') and a "GO" link with ajax parameters for POST the textField value to the current URL and refresh the grid, but this doesn't function, after insert a number in the textField and press the GO button nothing happens. This is the code I added at the end of the overrided "run" function:
echo CHtml::TextField('rowPages', $this->pageSize, array('size'=>'1', 'maxlength'=>'8', 'class'=>'yiiPager')); echo CHtml::link('GO', $this->createPageUrl($this->getCurrentPage()), array('id'=>'rowPagesButton', 'class'=>'yiiPager', 'ajax'=>array('type'=>'POST', 'data'=>'#rowPages', 'url' => $this->createPageUrl($this->getCurrentPage()))));
I think the problem is in Ajax parameters, I tried to eliminate them and now after pressing the GO link the grid is refreshed but it doesn't change the pageSize (because obviously is not posted to the URL, but how can I post correctly the "rowPages" value with Ajax?)
I tried also with an ajaxLink but with any result.
Thanks for helping me.