cancel
Showing results for 
Search instead for 
Did you mean: 

user sorting on ftl template

trelofysikos
Champ in-the-making
Champ in-the-making
I would like the user to be able to sort documents on my template by clicking on the row title.

to do this i' m using links on the row title that pass an variable on the url, like this
<a href="/alfresco/navigate/browse/workspace/SpacesStore/${space.id}?sort=id">ID</a>

on the FTL i' m trying to get this variable by using this code
<#assign keys = args?keys>
<#list keys as arg>    
   ${arg}
</#list> 

but it is not working. I have also tried
<#assign keys = sort?keys>
<#list keys as arg>    
   ${arg}
</#list> 

How can i get this variable from the url ? Is there an error in the link url?
15 REPLIES 15

trelofysikos
Champ in-the-making
Champ in-the-making
Thank you for your time and effort into this.

I finally decided to use a client javascript sort script because (I think) freemarker doesn't support descending sort
and also I was having these request problems.

mikeh
Star Contributor
Star Contributor
…because (I think) freemarker doesn't support descending sort…
?reverse

http://freemarker.org/docs/ref_builtins_sequence.html

Thanks,
Mike

mabayona
Champ on-the-rise
Champ on-the-rise
Just a sample code on how to sort in a ftl template:

<#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"]?sort_by(["properties", "cm:created"])  as child>

Just read the excelent ftl documentation to find out the details.

trelofysikos
Champ in-the-making
Champ in-the-making
ok thanks Smiley Happy
i just just read the documentation for freemarker sort and didn't find anything.

but still i can't solve the get args from url with freemarker. Can anyone help me with that ?

joksy
Champ in-the-making
Champ in-the-making
+1…. For me is the same now i m try to build a webscript for getting a url param……

joksy
Champ in-the-making
Champ in-the-making
Smiley Happy Hey guys through webscripts i can get the URL params Smiley Happy

But all other rootnodes such companyHome are not visible.
So at the end if someone use a ftl for presenting somethings through <r:template has no way to use url parameters. So ok that really strange