Jahia Dev Forum > How to use Tag in...

0 (0 Good)
0 (0 Bad)

How to use <jcr:sort> Tag in a JSP ?

by  julienfrance »  2014/08/13 09:08

Hello,

I would like to use the <jcr:sort> tag in a navMenu custom jsp to sort my submenus by 'jcr:title'. I get a list of JCRNodeWrapper by the jcr function getChildrenOfType() but my problem is tu set the properly value to the "properties" attribute.

In the javadoc, it's says that the first parameter must be a boolean but nothing for the others. It's seems to need the name of the propertie to sort and the direction but i don't knows the syntax of this attribute.

This my code, and the result, "sortedList", is always an empty list.

<c:set var="items" value="${jcr:getChildrenOfType(current,'jmix:navMenuItem')}"/>
<jcr:sort var="sortedList" properties="true, 'jcr:title', asc" list="items" scope="session"/>

Is anyone know how to use it or kwon how to set the "properties" attribute properly ?

Thanks,

Best regards,

Julien

  (julienfrance)

Number of messages  2
Registration date
0 (0 Good)
0 (0 Bad)

Re : How to use <jcr:sort> Tag in a JSP ?

by  kevan »  2014/08/13 09:48

Hello,

Your syntax is good, just try to remove the single quotes used to wrap the property name. the exact syntax for this property is: properties="true,jcr:title,asc"

I see also an error in your code, the property list of the jcr:sort is wrong, you need to use a JSP Expression Language (EL) to reference to items object. just change the property list="items" to list="${items}".

Best regards,

Kevan.

Number of messages  4
Registration date
0 (0 Good)
0 (0 Bad)

Re : Re : How to use <jcr:sort> Tag in a JSP ?

by  julienfrance »  2014/08/13 10:04

It works !

Thank you very much !  wink

Have a good day !

  (julienfrance)

Number of messages  2
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page