When you are working with Zope 2.4 you should have a look at the new 'sequence' module. This one has a sort() function for multi-column sort. This should fit your needs. ========================================================================== Andreas Jung andreas@digicool.com Digital Creations "Zope Dealers" http://www.zope.org ----- Original Message ----- From: "Benoit DOMINIAK" <koubonline@hotmail.com> To: <jean.lagarde@eer-rc.com> Cc: <zope@zope.org> Sent: Freitag, 13. Juli 2001 09:32 Subject: Re: [Zope] Choice of the sorting key of a dtml-in tag
Yes !!! That's it ! But know, how can I include reverse ;-) ? I've tryed : <a href="<dtml-var URL1>?skey=titre&rev=">Title</a> <a href="<dtml-var URL1>?skey=author&rev=">Author</a> <a href="<dtml-var URL1>?skey=bobobase_modification_time&rev= reverse">Last modification</a>
<dtml-if "REQUEST.has_key('skey')"> <dtml-else> <dtml-call "REQUEST.set('skey', 'bobobase_modification_time')"> <dtml-call "REQUEST.set('rev', ' reverse')"> </dtml-if>
<dtml-in "objectValues(['article'])" size=3 sort_expr="skey+rev" start=query_start>
But it just work with title and author (rev=none) but not with modif_time (rev=' reverse').
Can you help me ?
From: "Jean Lagarde" <jean.lagarde@eer-rc.com> To: <zope@zope.org> Subject: Re: [Zope] Choice of the sorting key of a dtml-in tag Date: Fri, 13 Jul 2001 07:20:31 -0700
Hi Benoit,
My first answer post!
Although I haven't tried that yet, my understanding is that 'sort' only accepts constants, i.e. it will interpret skey as the literal 'skey', not as its value. You need to use the undocumented 'sort_expr' instead, i.e.
<dtml-in "objectValues(['article'])" size=3 sort_expr="skey" start=query_start>
I'm not sure if you can include 'reverse' in skey; you probably have to state that separately in the dtml-in tag.
Hope that solves your problem,
Do a search on sort_expr on this list for more details.
Cheers,
Jean
On Friday 13 July 2001 15:03, you wrote:
Hi again,
I'd like to make a page with a list of my Zclass instances and to be able to sort them by different key. I tryed with this code :
<dtml-if "REQUEST.has_key('skey')"> <dtml-else> <dtml-call "REQUEST.set('skey', 'bobobase_modification_time reverse')"> </dtml-if> <dtml-in "objectValues(['article'])" size=3 sort=skey start=query_start>
But it doesn't work : instances are not sorted correctly...
Any idea ?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )