Sunday, September 25, 2011

Re: Pagination sorting question

I have never manually specified ASC and DESC links, I have always used
paginations default $this->Paginator->sort() links as shown in the
book which automagically works out if the link should sort ASC or
DESC:
http://book.cakephp.org/view/1233/Pagination-in-Views

I guess that by specifying both links at the same time it will of
course be forced to show both links. If you want it to check if the
current sort value for that column is ASC or DESC and then display the
opposite link then you will need to add some PHP logic in there to do
that.

This related post by teknoid may get you started:
http://nuts-and-bolts-of-cakephp.com/2008/07/28/displaying-sort-direction-in-paginated-data/

HTH, Paul

On Sep 23, 8:11 am, heohni <heidi.anselstet...@consultingteam.de>
wrote:
> Hi,
>
> I have these in my table header
>
> <?php echo $this->Paginator->link($html->image('dpdown.jpg'),array('sort' => 'OBJ_PREIS', 'direction' =>
>
> 'DESC'), $options = array('escape' => false)); ?>
>
>         <?php echo $this->Paginator->link($html->image('dpdownup.jpg'),array('sort' => 'OBJ_PREIS', 'direction' =>
>
> 'ASC'), $options = array('escape' => false)); ?>
>
> 2 little arrows which indicate the sorting for a price asc and desc.
>
> but in my source it show alway BOTH links like
>
> <a href="/gesamtobjekt/search/page:1/cat:1/sort:OBJ_PREIS/
> direction:asc">
> <img alt="" src="/img/dpdown.jpg">
> </a>
> <a href="/gesamtobjekt/search/page:1/cat:1/sort:OBJ_PREIS/
> direction:asc">
> <img alt="" src="/img/dpdownup.jpg">
> </a>
>
> I have by default the sortng for OBJ_PREIS ASC within my find()
> statement.
> What I do wrong to get the wrong links displayed?
>
> Please help!

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: