Oh, wait, sort is likely the field you want sorted?

so, i would think:
sort => 'id'
direction => 'asc'|'desc'

I'm trying to read this based on the following snippet (line 998):
        if (isset($options['sort']) && isset($options['direction'])) {
            $options['order'] = array($options['sort'] =>
$options['direction']);
        } elseif (isset($options['sort'])) {
            $options['order'] = array($options['sort'] => 'asc');
        }

>From what I can tell, if sort & direction are set (field & asc/desc), it'll
set the 'order' option. Alternatively, you can set 'order' yourself, looks
like it takes an array of field => direction

On 6/25/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
>
> According to cake/libs/controller/controller.php (function paginate), it
> appears you need to set "sort" and "direction":
> sort => true
> direction => 'asc'|'desc'
>
> it will check $this->params, $this->params['url'], and $this->passedArgs,
> so try it in your url, might be the easiest test for now
>
>
>
> On 6/25/07, kionae <[EMAIL PROTECTED]> wrote:
> >
> >
> > The problem is not getting paginate in 1.2 to work, but rather
> > changing the default sort order.  Everything is sorted in ascending
> > order on the ID field when the page initially loads, but I need it in
> > descending order on the date field... and for the life of me, I can't
> > find any way to specify this when calling $this->paginate() in the
> > controller.  The API has been less than helpful, as all it has to say
> > about paginate is:
> >
> > Controller::paginate    ( $object = null,
> >                 $scope = array(),
> >                 $whitelist = array()     )
> >
> > Handles automatic pagination of model records
> > Parameters:
> >         mixed   $object
> >         mixed   $scope
> >         array   $whitelist
> >
> > There has to be some way to tell it to spit things out in descending
> > order on whichever field I specify, instead of the default ascending
> > order on the ID field... I know I'm probably missing something
> > stupidly easy, but I can't figure it out.  Help?
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to