[opencms-dev] Ordering by a custom date field

Patric Dosch patric.dosch at virtual-identity.com
Fri Jan 20 11:47:04 CET 2012


Hey,

 

you can add the following in your xsd.

 

<xsd:annotation>                     

<mappings>

            <mapping element="Title" mapto="property:Title"/>

            <mapping element="Date" mapto="attribute:datereleased"/>

</mappings>

 

=> Additionally controls the display in the online instance.

 

 

or use the mapping:

<mapping element="Date" mapto="property:collector.date" />

 

 

This allows the collector to sort the files.

 

Greetings,

Patric

 

 

 

 

Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Jose Ignacio Yarza
Gesendet: Freitag, 20. Januar 2012 10:49
An: opencms-dev at opencms.org
Betreff: [opencms-dev] Ordering by a custom date field

 

Hello List,


This is my first post so greetings to everyone, and please bear with me.

I have a custom schema with this date field defined in it:

 
<xsd:element name="MyDate" type="OpenCmsDateTime" minOccurs="1" maxOccurs="1" />
 
 
I need to show listings ordered by this custom field. With some researh I found a collector and tried this in the JSPs:
 
<cms:contentload
               collector="allInFolderDateDesc" 
               param="/internet/news/notes/content_%(number).html|MyContentType|15|MyDate"
               pageSize="${param.pageSize}"
               pageIndex="1"
               editable="false">



But it does not work as I expected the list ordering is somewhat arbitrary. I have not found much documentation about this collector in particular so maybe something is wrong there.

Any help is very appreciated. This is a production system in a public administration, and this change is important for my customer since currently it shows the news disorderly.


Version is OpenCMS 7.


Thank you,

Jose 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120120/2fcafbde/attachment.htm>


More information about the opencms-dev mailing list