Reputation: 6736
I have model IndividualSystemSerialNumber
in cakephp1.3
and when i try to group by
mac_address
pagination not working.
But when i remove group
from paginate , it's working fine.
$this->paginate = array(
'order' => $order_by,
'group' => 'IndividualSystemSerialNumber.mac_address',
'page' => intval($page),
'limit' => $this->params['url']['iDisplayLength']
);
$systems = $this->paginate('IndividualSystemSerialNumber');
Upvotes: 2
Views: 1530
Reputation: 27354
I had same problem as you have now i don't know but paginate
has some problem when you use group
option.
So here is alternative solution that will work just awesome.
Example
$systems = $this->IndividualSystemSerialNumber->find('all',array
(
'order' => $order_by,
'group' => 'IndividualSystemSerialNumber.mac_address',
'page' => intval($page),
'limit' => $this->params['url']['iDisplayLength'],
'fields' => array
(
'IndividualSystemSerialNumber.mac_address',
//other related fields.
)
));
You have $page
that is number of page you are requesting and Model::find()
has option called page
that accept currently requested page number and you also have limit
set so above code will work as $this->paginate();
Cheers Enjoy Coding.
Upvotes: 3