[xwiki-users] sort problem or missunderstanding of tool?
Hello, So only by using the tools i can use lists and sort right? this code should work: $dateList.add($date) //it populates $sorter.sort($dateList,[${date}:asc]) //does not sort ##Collections.sort($dateList) or maybe $dateList.sort() //does not work -- View this message in context: http://n2.nabble.com/sort-problem-or-missunderstanding-of-tool-tp4106164p4106164.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] sort problem or missunderstanding of tool?
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
Re: [xwiki-users] sort problem or missunderstanding of tool?
#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/ 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 tddelete/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 -- View this message in context: http://n2.nabble.com/sort-problem-or-missunderstanding-of-tool-tp4106164p4106232.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] sort problem or missunderstanding of tool?
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/ 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 tddelete/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 -- View this message in context: http://n2.nabble.com/sort-problem-or-missunderstanding-of-tool-tp4106164p4106288.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] sort problem or missunderstanding of tool?
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/ 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 tddelete/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