Header for changin sorting order

Author Message

Marian Svetlik

Monday 04 April 2005 2:09:09 am

In one folder I have a several objects of my custom class - it has several attributes - name, company, att3, ...
At first objects are sorted by name. And I would like to add a function for users to be able to choose by which of the attributes they want to sort the objects.
Has anybody solved this? I believe it is a simple condition, I just can't get it.
Thanks a lot

Arran Price

Tuesday 05 April 2005 4:55:25 pm

Hi Marian,
seeing as how you dont have any other solutions offered yet...
You could just do the fetch again based on a different key. Im not sure how else you could re-sort.

Arran

Marian Svetlik

Tuesday 19 April 2005 7:30:19 am

Thanks for answer - the matter is that i don't know how to do this practically - let's say i use $order as a parameter for sort_by, but how should I add a value to the variable $order?

Eivind Marienborg

Tuesday 19 April 2005 7:44:48 am

You can get input from user with view parameteres, and then use this either directly or via a switch as sort filter :)

Eivind Marienborg

Tuesday 19 April 2005 7:48:04 am

Or have I misread your post? If you want to sort first by name, then by other attribute (when name is the same), then you can use an array in the sort order.

Marian Svetlik

Tuesday 19 April 2005 7:52:48 am

I don't understand only two things - what are "view parameters" and what is the "swith" :-)
I have never been strong in such things, but I have to complete this, so sorry for such questions...

Eivind Marienborg

Tuesday 19 April 2005 8:01:20 am

On view parameters, you might find info here:
http://www.ez.no/community/forum/developer/url_parameters

Switches:
http://www.ez.no/ez_publish/documentation/development/libraries/ez_template/functions/switch

Marian Svetlik

Thursday 21 April 2005 5:10:06 am

Thx a lot, i think the view parameter will work - i'll try it and report the results :-)
Thanks

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.