Check out $util, it has a lot of useful methods. http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D2.1%2Dmilestone%2D1%2Djavadoc.jar/com/xpn/xwiki/api/Util.html
-Joshua Bubulina wrote: > this works: > > #foreach ($d in $xwiki.sort($dateList)) > <td>$d</td> > #end > > > Bubulina wrote: > >> " >> #foreach($subdoc in $allPages) >> >> #set($suffix = $subdoc.substring(0,3)) >> #if($suffix == "stge") >> <tr> >> #set($rcDoc = $xwiki.getDocument($subdoc)) >> #set($rcDt = >> $xwiki.jodatime.getDateTime($rcDoc.getDate().getTime())) >> #set($documentDate = >> $xwiki.formatDate($rcDt.toDate(), "dd/MM/yyyy >> HH:mm:ss")) >> >> $dateList.add($documentDate) >> ##$dateList >> ##Collections.sort($dateList) >> ##$dateList.sort() >> >> $sorter.sort($dateList, >> $msg.get('core.viewers.history.date')) >> >> >> >> <td id="date">$documentDate</td> >> <td> $subdoc $subdoc </td> >> <td>delete</td> >> </tr> >> #end >> #end >> >> " >> >> >> vmassol wrote: >> >>> On Dec 3, 2009, at 2:54 PM, Bubulina wrote: >>> >>> >>>> Hello, >>>> >>>> So only by using the tools i can use lists and sort right? >>>> this code should work: >>>> >>>> >>> Show us the full code. We can't see how you've initialized the >>> dateList array. >>> >>> >>>> $dateList.add($date) //it populates >>>> $sorter.sort($dateList,["${date}:asc"]) //does not sort >>>> >>> What is $sorter? >>> >>> You could use $sorttool: >>> http://velocity.apache.org/tools/releases/1.4/javadoc/org/apache/velocity/tools/generic/SortTool.html >>> >>> >>>> ##Collections.sort($dateList) >>>> or maybe >>>> $dateList.sort() //does not work >>>> >>> Java List class doesn't have such a method! Why would you expect it to >>> work? >>> >>> See >>> http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html >>> >>> Thanks >>> -Vincent >>> >>> _______________________________________________ >>> users mailing list >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> >>> >>> >> > > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users