velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Fenbers <Mark.Fenb...@noaa.gov>
Subject Re: Sorting a nested tree
Date Sat, 15 Aug 2009 13:42:57 GMT
This appears to be a non-standard sort(), meaning that you are not 
sorting alphabetically or numerically, and so you would need a custom 
sort routine in your Java code.  If you perform this sort() in Java 
(independent of Velocity), does it work?  If not, override your sort 
method with your customizations for this data-type...

Mark

rezkiyn wrote:
> Hi all,
>
> I am trying to sort a nested tree where I would like to sort on a child of
> the root element being the end date.
>
> The structure is : 
>
> [{name=Education
>   , data=Quality Management, type=text, options=[]
>   , Level={name=Level, data=Bachelor, type=list, options=[]}
>   , End_Date={name=End_Date, data=30/06/2000, type=text, options=[]}
> }},
>  {name=Education
>    , data=Computer Science, type=text, options=[]
>    , Level={name=Level, data=Bachelor, type=list, options=[]}
>    , End_Date={name=End_Date, data=30/06/2000, type=text, options=[]}
> }}, 
> {name=Education
>   , data=Business Economics, type=text, options=[]
>   , Degree={name=Degree, data=MagnaCumLaude, type=list, options=[]}
>   , Level={name=Level, data=Master, type=list, options=[]}
>   , End_Date={name=End_Date, data=01/01/2008, type=text, options=[]}
> }}] 
>
> The function I am calling is, but does not seem to work
>
> #foreach($obj in $sorter.sort($Education.getSiblings().getChild("End_date"),
> "data"))
>    $obj.getData()
> #end
>
> Can someone help me
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message