0
votes

I am using paginate in cakephp 2, I have created the page in paginator,

but I have trouble when i want to show all data, because paginate make the data limit, i want the data is limitless or all datas,

this is my code paginate set conditions and limit,

$this->paginate = array(
                'conditions'    => $conditions,
                'limit'         => 20,
            );  

and the data when i print, start from 0 and end at 19, it means the paginate limit setting is running,

then I have created other statement which the data must be show all like the conditions,

this is the code,

$this->paginate = array(
                        'conditions'    => $conditions,
                    //    'limit'  => 20
                    );

I just make the paginate setting as conditions, I comment the limit setting, but the data also show 20,

I have tried to change the code like this,

$this->paginate = array(
                        'conditions'    => $conditions,
                        'limit'     => 100,
                        'maxLimit'  => 10000
                    );

the data show 100,

how I can show all data without I make limit and maxLimit, or how I can show all data with conditions but not automatic limit (20 data)

because I am do not know the data total, somebody can help me ?

thanks before..

1
i am not sure about it but you can read this [sanisoft.com/blog/2011/02/28/…shubham715
i already that posting, but not answer T_TOnesinus Saut
what if you give 'limit' => 12345678912345678Klaus Mikaelson
This makes no sense at all. Why would you use paginate if you want to display all any way...?floriank
This will blow up sooner or later depending on the amount of retrieved data from the DB and the available memory.floriank

1 Answers

1
votes

There is no direct way to fetch all records but you can try either one of the following lines:

$all = $this->ModelName->find('count', array('conditions'=> $conditions));

Or try:

$alldata = $this->ModelName->find('all', array('conditions'=> $conditions, 'limit' => $all));

This will fetch all records from tables and you can manage it in view according to your need.