I think this is a shortfall in 1.2 paginator. Apparently it was done
as a security measure. I think there are plans to fix it, however my
hack was to do a str_replace to the output of paginator. You could
also override the paginator helper and do it that way (might be
cleaner) but if you're into hacks, then the following works!

Keep in mind I wrote this late at night a few days after I started
using cakephp, just before a deadline.

I used this in my view. I have taken out unrelated html and php so you
can see whats going on. Hope this helps (and I hope they fix this
"bug").

Cheers,
Adam

<?php

list($field, $direction) = each($params['options']['order']);

function fixvenuelink($text,$field,$direction){
        if ($field == 'Venue.title' && $direction == 'asc'){
                return str_replace('direction:asc','direction:desc',$text);
        }
        return $text;
}

function fixpaginglinks($text,$field){
        if ($field == 'Venue.title'){
                return str_replace('sort:title','sort:Venue.title',$text);
        }
        return $text;
}

?>
<!-- headers -->
<?php echo $paginator->sort('Event Title','title') ?>
<?php echo $paginator->sort('Date','start_date') ?>
<?php echo fixvenuelink($paginator->sort('Venue','Venue.title'),$field,
$direction) ?>

<!-- paging links -->
<?php echo fixpaginglinks($paginator->next('Next'),$field); ?>




On Sep 2, 8:57 pm, phpjoy <[EMAIL PROTECTED]> wrote:
> in my index.ctp I have the following code:
> <th><?php echo $paginator->sort('Title', 'title');?></th>
> <th><?php echo $paginator->sort('Layout Name', 'LayoutWidget.name');?
>
> ></th>
>
> When I try to sort the table in the column 'title' it works like a
> charm.
> When I try to sort the Layout Name column, it works just for 'asc'.
> When I want to click it again, the direction stays on 'asc' instead of
> 'desc'.
>
> Any ideas how I can fix this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to