OK, I understand. It looks like you'll need to check $this->params and
deal with yourself some of the things paginator does automatically.
The principle is the same, however: just add however many fields you
need to the order array.

It seems like you're going to make the interface overly complicated,
though. But, without seeing your app, I can't really judge. Just an
observation.

On Tue, May 26, 2009 at 12:56 PM, Bs <sommerf...@hs-heilbronn.de> wrote:
>
> Hi,
>
> thanks for the hint but I want to provide the users with buttons to
> paginate the index view dynamically. Just like written in this howto
>
> http://book.cakephp.org/view/166/Pagination-in-Views
>
> but not only for singular columns but for 2, 3 or more so that they
> can order their view after country, region and city for example. Right
> now the code in my index view looks like this:
>
> <th><?php echo $paginator->sort('Country', 'Country'); ?></th>
>
> And what I would like to do is something like this:
>
> $sort[] = "Country"; $sort[] = "Region"; $sort [] = "City";
> <th><?php echo $paginator->sort($sort, 'Country'); ?></th>
>
> So that the view is sorted by several keys when the user clicks.
>
>
> On 26 Mai, 18:37, brian <bally.z...@gmail.com> wrote:
>> On Tue, May 26, 2009 at 11:56 AM, Bs <sommerf...@hs-heilbronn.de> wrote:
>>
>> > Hi,
>>
>> > I'm trying to order my index view by several conditions. As far as I
>> > can see from the documentation, the $paginator only accepts one key
>> > for sorting the model.
>>
>> >http://book.cakephp.org/view/166/Pagination-in-Views
>>
>> >  What is the best practice to order my model by several keys? (For
>> > example, ordering my cities by country, region, and city name in my
>> > index view)
>>
>> 'order' => array(
>>         'City.country' => 'ASC',
>>         'City.region' => 'ASC',
>>         'City.name' => 'ASC'
>> )
> >
>

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

Reply via email to