oceatoon
(Oceatoon)
November 12, 2012, 6:39am
1
Hi
lately I posted here
but having received no answer
I’m opening a new topic since the question seems quite clear , but I wasn’t able to dig out the answer.
Everyone probably noticed how on cgridview ajax pagination a GET parameter specificaly named ModelName_page
keeps track in the button links of where the user wants to go.
Unfortunetly this parameter isn’t generated for the first page Link
but in my use case I need it to be consistent
but I can’t find where / in which Class, ModelName_page is added to the GET object ?
saying it differently might help find the answer
in the pagination links of a CgridView, how come the page#1 Link doesn’t have modelName_page value on the link ? How can I make it consistent ?
Thanks for shedding some light
Tibor
seenivasan
(Chellamnivas)
November 12, 2012, 8:27am
2
Dear Friend
We have to tweak the CPagination::createPageUrl method to acheive the desired functionality.
public function createPageUrl($controller,$page)
{
$params=$this->params===null ? $_GET : $this->params;
if($page>=0) //Here I have made a change.
$params[$this->pageVar]=$page+1;
else
unset($params[$this->pageVar]);
return $controller->createUrl($this->route,$params);
}
Regards.
oceatoon
(Oceatoon)
November 12, 2012, 9:19am
3
I can’t find where / in which Class, ModelName_page is added to the GET object ?
saying it differently might help find the answer
in the pagination links of a CgridView, how come the page#1 Link doesn’t have modelName_page value on the link ? How can I make it consistent ?
well the answer is : it’s done on intialisation of the ajax Cgrid Feature
as you can see below , defining the pageVar parameter connects the pagination
which is why it wasn’t an obvious find it’s outside of the php generated CGrid Classes, on the client JS side.
$('#<?php echo $gridId?>').yiiGridView({'ajaxUpdate':['1','<?php echo $gridId?>'],
'ajaxVar':'ajax',
'pagerClass':'pager',
'loadingClass':'grid-view-loading',
'filterClass':'filters',
'tableClass':'round-table',
'selectableRows':1,
'pageVar':'Actions_page'});
might help someone else
Regards