cancel
Showing results for 
Search instead for 
Did you mean: 

Sort document in preferred sequence

jade
Champ in-the-making
Champ in-the-making
Hi, could someone kindly advise me on this matter?

My situation is like this: 
I have 10 documents in Space A which i need to split 5 documents into sub Space A1 and another 5 into sub Space A2. When my user logins into my web application, i need to use a template to retrieve list of documents from Space A1 and A2.

My questions:
1. Can i retrieve 2 sub spaces using 1 template?
2. Is there any way to sort my list into my preferred sequence because currently all the documents are ordered by name. I think it would be critical if i add number in front of my file name because in future my user might need to change the sequence of the documents again.

Thanks,
jade
1 REPLY 1

mikeh
Star Contributor
Star Contributor
1. Can i retrieve 2 sub spaces using 1 template?
Sure. In Freemarker you can iterate through the child spaces:
<#list space.children?sort_by('name') as child>
   <#if child.isContainer>
   …an inner loop to get documents…
   </#if>
</#list>

2. Is there any way to sort my list into my preferred sequence because currently all the documents are ordered by name. I think it would be critical if i add number in front of my file name because in future my user might need to change the sequence of the documents again.
That depends what your sequence needs to be. If it's a property then you can use the Freemarker sort_by function (see above) otherwise you might have to use Javascript to sort the list manually.

Check through http://wiki.alfresco.com/wiki/Template_Guide and http://wiki.alfresco.com/wiki/JavaScript_API for more details.

thanks,
Mike