Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set max limit for pagination in cakephp

Tags:

cakephp

My code

  $this->paginate=array(
          'conditions' =>array('OrderDetail.order_id'=>$id),
            'maxLimit' => 500));

$this->paginate=array(
          'conditions' =>array('OrderDetail.order_id'=>$id),
            'limit' => 500));

Both result giving me 100 records max thou i set limit as 500,as if i set 500 i need 500 records.! can any body help me on this ?

like image 255
jsduniya Avatar asked Jun 06 '13 13:06

jsduniya


People also ask

How can I paginate in CakePHP?

CakePHP eases the burden on the developer by providing a quick, easy way to paginate data. Pagination in CakePHP is offered by a component in the controller. You then use View\Helper\PaginatorHelper in your view templates to generate pagination controls.

What does it mean to paginate a document?

Pagination is the process of separating print or digital content into discrete pages. For print documents and some online content, pagination also refers to the automated process of adding consecutive numbers to identify the sequential order of pages.


1 Answers

If you think about it: You need to combine them.

public $paginate = array(
    // other keys here.
    'maxLimit' => 500,
    'limit' => 500
);

You need to first raise the maxLimit to the absolute limit you want to allow. Then you can set the limit to any value up to this point. Only setting one of them does not change anything (logically).

like image 56
mark Avatar answered Oct 19 '22 16:10

mark