There is usually (always?) a way to do this based on your business rules. If 
these are transactions of some sort they will have been created in an order. If 
your table doesn't include a way of tracking creation order I'd go back there 
first. If this is the result of a stored procedure or query that amalgamates 
data into a normalised view I'd go back to that and see what I could do. I'd 
amend the SQL to include another column from one of the source tables that does 
reflect order.

If there really is nothing in the data that enforces an order then at best you 
can expect random and varying results. If not (maybe that's just the way it is) 
then the very last resort would be to add a new key to the resulting data 
array, parse the data array and populate it with an incrementing value and use 
that as the order (but even as I type that it suggests there must a way to 
order the data). That's a really really bad last resort, but if ordering is 
that important and otherwise impossible you might consider it.

I'd say that going right back to basics is the best course, if you can. In my 
experience the database design is *the most important factor* in a site's 
design as everything else that is built on it is made easier when it is right 
and more complex when it is not.

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 21 Apr 2011, at 07:25, Krissy Masters wrote:

> Just curious,
> 
> "show it by created date" is that not ordering it by date?
> 
> K
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of lucas
> Sent: Thursday, April 21, 2011 2:49 AM
> To: CakePHP
> Subject: Re: set paginator last page as default?
> 
> Hi Jeremy, the data can´t be ordered beacuse it´s a business account
> data (extracted from a database view) and i need to show it by created
> date with all the debts, payments and the actual balance (is because
> of the balance that i can´t let the user to specify some kind of
> order).
> 
> Lucas.
> 
> 
> On 19 abr, 06:03, euromark <[email protected]> wrote:
>> i angree with jeremy
>> either you CAN order your data and you can use pagination
>> or you CANT order it than pagination is not usable anyway :)
>> 
>> On 19 Apr., 05:30, Jeremy Burns | Class Outfit
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> <[email protected]> wrote:
>>> Out of interest then, what happens when a user clicks the '2' page tab?
> I'm intrigued that you say you data can't be ordered - so is the actual data
> randomly ordered? Or ordered by 'created'? If not, who how or what decides
> the actual order of the data? Does it have an auto incrementing id column?
> If not, can you add one?
>> 
>>> Jeremy Burns
>>> Class Outfit
>> 
>>> [email protected]
>>> (t) +44 (0) 208 123 3822
>>> (m) +44 (0) 7973 481949
>>> Skype: jeremy_burnshttp://www.classoutfit.com
>> 
>>> On 18 Apr 2011, at 21:38, lucas wrote:
>> 
>>>> Thanks stats kim, i already know about that solution. It seems there
>>>> is nothing built in at core level to achieve this.
>>>> It´s not an elegant solution but it works fine and it´s practical.
>> 
>>>> For those who need something like this, before call the paginate
>>>> method, put this line $this->paginate['page'] = 99999; or a bigger
>>>> number...
>> 
>>>> Thanks for all the responses.
>> 
>>>> On 18 abr, 17:23, stas kim <[email protected]>
>>>> wrote:
>>>>> What you can do is set page parameter in your controller to 'last'
>>>>> or some huge number larger than projected page count.
>>>>> And it will miraculously bring you to the last page. whatever that
>>>>> last page's number is.
>>>>> That is the way Controller::paginate works in 1.3
>> 
>>>>> On Mon, Apr 18, 2011 at 3:42 PM, lucas <[email protected]> wrote:
>>>>>> I can´t do that because the data can´t be ordered. I need it in that
>>>>>> way...
>> 
>>>>>> On 18 abr, 16:37, Tilen Majerle <[email protected]> wrote:
>>>>>>> yes...instead of order => "YourModel.field ASC" type
> "YourModel.field DESC"
>>>>>>> and you will have newest posts/whatever in top of pages
>>>>>>> --
>>>>>>> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>> 
>>>>>>> 2011/4/18 Jeremy Burns | Class Outfit <[email protected]>
>> 
>>>>>>>> Sort the data in reverse order?
>> 
>>>>>>>> Jeremy Burns
>>>>>>>> Class Outfit
>> 
>>>>>>>> [email protected]
>>>>>>>> http://www.classoutfit.com
>> 
>>>>>>>> On 18 Apr 2011, at 20:32, lucas wrote:
>> 
>>>>>>>>> Hi people, is it possible to set asdefaultthe last page of the
>>>>>>>>> paginated data from the controller? Is there an option available
> to do
>>>>>>>>> this?
>> 
>>>>>>>>> thanks in advance!
>> 
>>>>>>>>> --
>>>>>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>>>>> http://tv.cakephp.org
>>>>>>>>> Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
>>>>>>>> others with their CakePHP related questions.
>> 
>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>> [email protected] For more options, visit
> this group
>>>>>>>> athttp://groups.google.com/group/cake-php
>> 
>>>>>>>> --
>>>>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>>>>> http://tv.cakephp.org
>>>>>>>> Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
>>>>>>>> others with their CakePHP related questions.
>> 
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> [email protected] For more options, visit this
> group
>>>>>>>> athttp://groups.google.com/group/cake-php
>> 
>>>>>> --
>>>>>> Our newest site for the community: CakePHP Video
> Tutorialshttp://tv.cakephp.org
>>>>>> Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelpothers with their CakePHP related
> questions.
>> 
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected] For more options, visit this
> group athttp://groups.google.com/group/cake-php
>> 
>>>> --
>>>> Our newest site for the community: CakePHP Video
> Tutorialshttp://tv.cakephp.org
>>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> others with their CakePHP related questions.
>> 
>>>> To unsubscribe from this group, send email to
>>>> [email protected] For more options, visit this
> group athttp://groups.google.com/group/cake-php
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to