Actually you can do this in your view: $paginator->sort('Name','name',array('direction'=>'desc'));
At least the API says that. But I tried and it didn't work. Maybe it's not yet implemented in the current 1.2beta. Or my syntax is not correct. Anyone any idea? Donnerbeil On 20 Mai, 11:09, Tim W <[EMAIL PROTECTED]> wrote: > In the end my solution was to copy the paginator helper class to my > application helpers directory, then in the sort method swap every > instance of "asc" and "desc". It's not a great solution, but it works. > I'd love to hear about better solutions to get the initial sort > direction to be desc instead of asc. > > On May 8, 12:35 am, Tim W <[EMAIL PROTECTED]> wrote: > > > Thanks Marcin. > > > I don't think i've been entirely clear. I can easily set the sort > > order programmatically, but when the user first clicks on a link to > > sort a column it automatically sorts ASC. I'd like to change that > > behavior to default first to DESC. I can do it by hacking around with > > the cake source, or doing it myself, I just wondered if there was a > > way built in, since it'd probably be a pretty common thing to try to > > do. If not i'll add it and see if I can work out how to submit a > > change request. > > > Cheers > > > Tim > > > On May 7, 10:33 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote: > > > > 'order' => 'Model.column DESC' > > > > On Wed, May 7, 2008 at 11:26 AM,TimW<[EMAIL PROTECTED]> wrote: > > > > > Thanks for the suggestion, but unfortunately it didn't work for me. > > > > > SQL Error: 1054: Unknown column 'DESC' in 'order clause' > > > > > I'll spend some time to work this out at some point, i'll post when I > > > > do, unless someone's worked it out already and can tell me. > > > > > Thanks > > > > > Tim > > > > > On May 7, 8:11 pm, "Andras Kende" <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > > try this in your controller: > > > > > > var $paginate = array('limit' => 100, 'page' => 1, 'order' => > > > > 'DESC'); > > > > > > Andras Kende > > > > > >http://www.kende.com > > > > > > -----Original Message----- > > > > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > > > > > > OfTimW > > > > > Sent: Tuesday, May 06, 2008 9:26 AM > > > > > To: CakePHP > > > > > Subject: Making Paginator first sort direction DESC > > > > > > Hi all, > > > > > > Paginator's great, like the rest of Cake, but there's one little > > > > thing > > > > > I haven't been able to work out. By default when you click on a > > > > column > > > > > to sort it will sort ASC (ascending), but i'd like the first sort to > > > > > be DESC (descending). The options suggest this might be possible, but > > > > > I haven't worked it out. Does anyone know if this is possible? > > > > > > Thanks > > > > > >TIm > > > > -- > > > Marcin Domanskihttp://kabturek.info --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---