Apparently another way is to do:
$this->params['order'] = array();
$this->params['order']['id'] = 'desc';

On 6/25/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
>
> Where are you calling paginate from? in your controller?
> if so, just try
> $this->params['sort'] = 'id';
> $this->params['direction'] = 'desc';
>
> before you call $this->paginate();
>
> On 6/25/07, kionae <[EMAIL PROTECTED]> wrote:
> >
> >
> > The problem with that is that I can't figure out how/where to set
> > them.  They don't seem to come from the parameters passed through the
> > paginate function in the controller, but rather from the $options
> > array and I don't know how to set things in the $options array.
> >
> >
> >
> > On Jun 25, 1:56 pm, "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