Render Cgridview Pager Separately

Is it possible to render CGridView pager separately. For example, there is special placeholder on webpage for pagers defined in layout and it is required to display pager only there for every view that uses this layout.

Thanks.

it is possible:

in layout first define the placeHolder :




//  someLayout :


   if(isset($this->clips['pager'])){

            echo $this->clips['pager'];

   }




now you should pass the pager clip to the layout file (some other action/view will ignore the pager clip ):




   // let 's say it is your admin.php :


  $gridView =   $this->widget('zii.widgets.grid.CGridView',array('templage'=>'{items}{summary}'..));


 // few people know $this->widget return a widget obj and seldom use that object 


    // now you should pass the pager to the layout file:


    $this->beginClip('pager');

       $gridView->renderPager();

    $this->endClip();






you’d better to see the CClipWidget class . and think about why i use clip to pass html section to layout file :lol:

Wow, nice. I didn’t know that.

Thanks for the tip!

Thank you so much! It is really that behaviour I’ve searched for.