I don't think you can decide the direction in that way. Even though sortDir() has an options parameter and a directions key it looks for.... when you use sort() the options do not get passed along to sortDir()
http://api.cakephp.org/view_source/paginator-helper/#line-163 http://api.cakephp.org/view_source/paginator-helper/#line-215 Generally you wont have to decide the direction either. A single button can handle both directions. Paginator figures it out on its own based on the rules: If the ordering is by the current field, reverse the direction. If it is ordered by another field, order by this field and default to ASC direction. On Feb 4, 1:08 am, Mike Cook <[email protected]> wrote: > I'm rather new to cake and I'm having trouble understanding how to > have a simple sort on a title field using the pagenator. > > All I need is two links, one ascending and the other descending -- > Title (ASC) | Title (DESC) > > At first I thought I could just set sort/direction, but perhaps doing > this from the index view is not correct (I tried various combinations > but without any luck); > > echo $paginator->sort( 'Title (DESC)', 'title', array > ('direction'=>'desc') ); > > I've searched through a bunch of threads (such as "Probably a > ridiculously easy-to-solve problem with 1.2's paginate") and from what > I could see you can set the direction in the controller, but this > seems to be fixed one way or the other. > > I was hoping someone could give me directions (pun completely > intended ;) on how to pass these params. > > Thanks for your help. > > Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
