Saturday, September 22, 2012

Re: How to use order by field in pagination.

i hope i understand you good, but pagination is created for records from database..for ordering arrays and stuff like that use Set (in new version is Hash) class from cake :)

http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html 
--
Lep pozdrav, Tilen Majerle



2012/9/22 Steve Babs <pan.sathish@gmail.com>
I am having array like,

$mysort_array = array(7,1,3,2,5) .


I want pagination data order by above array value ordered.

ex,

'order' => array('Table.id'=> $mysort_array).

My pagination result should be ordered like below,

Table.id => 7,
Table.id => 1,
Table.id => 3,
Table.id => 2,
Table.id => 5,


Order By Field only works in find query. Not in pagination, Please guys help me to come out from this problem.


--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: