Question Regarding Clistview Pager

By default, the pager sends a GET parameter for the page number, e.g for Product model, it would be Product_page.

My question is, where in the controller / model does it detect this parameter?

Which particular API property/method handles this parameter?

The reason I ask is because I want to pass in the page number using a hidden input in a search form.

Anybody got any idea?

See the method CPagination::getCurrentPage.

This will check $_GET[‘page’], ‘page’ is the default attribute value of the property ‘pageVar’ of the pagination.

In the method fetchData of the dataprovider, the limit (currentpage/offset) will be added from the pagination.

Possible solutions in your controller action before creating the dataProvider:

  • The simplest: $_GET[‘page’]=$_POST[yourhiddenfieldname]

  • Create the paginationmanually, call


$pagination->setCurrentPage($_POST[yourhiddenfieldname])

and assign the pagination to the dataprovider.

  • Create you own pagination by overriding CPagination::getCurrentPage()

Hi Joblo, thanks for your help. It makes more sense now.

In relation to this I created another topic here: http://www.yiiframework.com/forum/index.php/topic/56205-clistview-custom-pager-links/

I would be grateful if you could take a look and advise. Thanks.