[英]Why is CakePHP 1.3 Pagination ignoring my order?
I have a reports model, and I for the life of me cannot get it to change the order because of the use of the $this->paginate() in displaying the data. 我有一个报告模型,由于使用了$ this-> paginate()来显示数据,我一生中都无法改变它的顺序。 What am I doing wrong?
我究竟做错了什么? It's as if the $paginate variable I set up has no impact whatsoever on the next line where $this->paginate() is called.
好像我设置的$ paginate变量对调用$ this-> paginate()的下一行没有任何影响。
$this->Report->recursive = 0;
$paginate = array('order' => array('Report.id' => 'DESC'));
$this->set('reports', $this->paginate());
UPDATE: 更新:
I have tried a few more things, with no success at all. 我尝试了几件事,但都没有成功。
Neither the order, or the limit have any effect on the output of $this->paginate(); 顺序或限制都不会影响$ this-> paginate()的输出;
Try this.. 尝试这个..
$this->paginate = array('Report' => array('order' => 'Report.id' => 'DESC'));
Replace your second line 替换第二行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.