How to get page number in Yii -


i using yii show list page, shown in several pages automatic via zii.widgets.clistview.

when user click next page, url not change. need know page user viewing.

how can page number in yii?

disable ajax on cviewlist with 'ajaxupdate'=>false

you wont current page number directly because of ajax calls. if disable ajax clistview can able current page numbers on page load.

my sample controller

     <?php      $dataprovider = new cactivedataprovider('mymodel', array('pagination' => array('pagesize' => 3)));      $this->render('myviewpage', array('dataprovider' => $dataprovider));      ?> 

now check view

    <?php     $this->widget('zii.widgets.grid.cgridview',          array(                 'dataprovider' => $dataprovider,                 'ajaxupdate'=>false             ));      echo "current page number is: ".(int)($dataprovider->pagination->getcurrentpage()+1);     ?> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -