tags:

views:

322

answers:

1

Hi,

i am trying to use the pagination concept in Cakephp for my application ..

var $paginate = array( 'limit' => 5, 'order' => array( 'Report.report_id' => 'desc' ) );

ANd in the cakephp action

        $conditions=array('Report.user_id'=>$userId);
        $this->paginate['Report']['conditions']=$conditions;
        $this->paginate['Report']['group']='Report.report_id';
        $this->paginate['Report']['limit']=5;
        $allreports=$this->paginate('Report');

Now this gives me the actual 5 entries of the Query with the group by condition but i m not getting the page numbers now in the View..

in the View

i have used like

         <?php  echo $paginator->numbers(); ?>

but it doesnt displays anything ?? why so.. guide me...

+2  A: 

Although Model::find() supports the group parameter, support for it has not been implemented for pagination. If you pass a group into $paginate, although it will return the correct results, it will return an inconsistent record COUNT (used to determine the number of pages). There is a ticket to add support for this but it won't be implemented until CakePHP 2.x. In the meantime, you will have to override paginateCount() in your model as outlined in the examples under Custom Query Pagination in the manual.

deizel